TextFieldParser.ReadToEnd Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads the remainder of the text file and returns it as a string.
public:
System::String ^ ReadToEnd();
public string? ReadToEnd ();
public string ReadToEnd ();
member this.ReadToEnd : unit -> string
Public Function ReadToEnd () As String
Returns
The remaining text from the file or stream.
Examples
This example uses the ReadToEnd
method to read the entire file ParserText.txt
and write it to the file Testfile.txt
.
Using FileReader As New Microsoft.VisualBasic.FileIO.
TextFieldParser("C:\ParserText.txt")
Dim allText As String = FileReader.ReadToEnd
My.Computer.FileSystem.WriteAllText("C://testfile.txt", allText, True)
End Using
If Testfile.txt
does not exist, it is created by the WriteAllText
method.
Remarks
This is an advanced member; it does not show in IntelliSense unless you click the All tab.
If there is nothing more to read because the end of the file has been reached, Nothing
is returned.
The ReadToEnd
method does not ignore blank lines and comments.