A Use the following code:
Dim fs As New FileStream("C:\file.txt", FileMode.Open)
Dim sr As New StreamReader(fs)
Dim data As String = sr.ReadToEnd()
sr.Close()
Console.WriteLine(data)
B Use the following code:
Dim fs As New FileStream("C:\file.txt", FileMode.Open)
Dim data As String = sr.ReadToEnd()
fs.Close()
Console.WriteLine(data)
C Use the following code:
Dim fs As New FileStream("C:\file.txt", FileMode.Open)
Dim data As New StringBuilder()
Dim data As String
While sr.Peek() > -1
data += sr.ReadLine()
End While
sr.Close()
Console.WriteLine(data)
D Use the following code:
Dim fs As New FileStream("C:\file.txt", FileMode.Open)
Dim sr As New StreamReader(fs)
Dim data As New StringBuilder()
While sr.Peek() > -1
data.Append(sr.ReadLine())
End While
sr.Close()
Console.WriteLine(data.ToString())