C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
And: We assign a String variable to the contents of the return value of ReadToEnd.
VB.NET program that uses StreamReader ReadToEnd
Imports System.IO
Module Module1
Sub Main()
' Wrap StreamReader in using block.
Using streamReader As StreamReader = New StreamReader("C:\programs\file.txt")
' Get entire contents of file in string.
Dim contents As String = streamReader.ReadToEnd()
Console.WriteLine(contents)
End Using
End Sub
End Module
Output
Thank you
Friend