TextFieldParser.ReadToEnd 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
讀取剩餘的文字檔,並以字串形式回傳。
public:
System::String ^ ReadToEnd();
public string ReadToEnd();
member this.ReadToEnd : unit -> string
Public Function ReadToEnd () As String
傳回
檔案或串流中剩餘的文字。
範例
此範例使用 的方法 ReadToEnd 來讀取整個檔案 ParserText.txt 並將其寫入檔案 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
若 Testfile.txt 不存在,則由該方法產生 WriteAllText 。
備註
這是進階成員;除非你點選 「全部 」標籤,否則它不會在 IntelliSense 中顯示。
若檔末端已至 Nothing ,則返回。
此 ReadToEnd 方法不會忽略空白行與註解。