TextReader.ReadToEndAsync 方法

定義

非同步讀取從目前位置到文字讀取器末端的所有字元,並將它們以單一字串傳回。Reads all characters from the current position to the end of the text reader asynchronously and returns them as one string.

public:
 virtual System::Threading::Tasks::Task<System::String ^> ^ ReadToEndAsync();
public virtual System.Threading.Tasks.Task<string> ReadToEndAsync ();
[System.Runtime.InteropServices.ComVisible(false)]
public virtual System.Threading.Tasks.Task<string> ReadToEndAsync ();
abstract member ReadToEndAsync : unit -> System.Threading.Tasks.Task<string>
override this.ReadToEndAsync : unit -> System.Threading.Tasks.Task<string>
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member ReadToEndAsync : unit -> System.Threading.Tasks.Task<string>
override this.ReadToEndAsync : unit -> System.Threading.Tasks.Task<string>
Public Overridable Function ReadToEndAsync () As Task(Of String)

傳回

Task<String>

表示非同步讀取作業的工作。A task that represents the asynchronous read operation. TResult 參數的值會包含字串,該字串含有從目前位置到文字讀取器結尾的字元。The value of the TResult parameter contains a string with the characters from the current position to the end of the text reader.

屬性

例外狀況

字元數大於 MaxValueThe number of characters is larger than MaxValue.

文字讀取器已處置。The text reader has been disposed.

之前的讀取作業目前正在使用讀取器。The reader is currently in use by a previous read operation.

備註

類別是抽象類別,The TextReader class is an abstract class. 因此,您的程式碼中不必將它執行個體化。Therefore, you do not instantiate it in your code. 如需使用方法的範例 ReadToEndAsync ,請參閱 StreamReader.ReadToEndAsync 方法。For an example of using the ReadToEndAsync method, see the StreamReader.ReadToEndAsync method.

適用於

另請參閱