Answer:
There is a text file named "MsgSrikanth.txt" which has contents. Now we can convert that entire text file into a single string variable called showResult.
That conversion is shown below :
In
VB.NET
Dim showResult As String = NothingDim reader as New
StreamReader("MsgSrikanth.txt")showResult = reader.ReadToEnd()
In
C#.NET
string showResult = NothingDim;
StreamReader reader = new StreamReader("MsgSrikanth.txt");
showResult = reader.ReadToEnd();
ReadToEnd() method used to read content from the current position to the end of the file.
Asked In: Many Interviews |
Alert Moderator