TextReader.ReadToEndAsync TextReader.ReadToEndAsync TextReader.ReadToEndAsync TextReader.ReadToEndAsync Method

定義

非同步讀取從目前位置到文字讀取器末端的所有字元,並將它們以單一字串傳回。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();
[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>
Public Overridable Function ReadToEndAsync () As Task(Of 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.

例外狀況

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

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

備註

TextReader 類別是抽象類別。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.

適用於

另請參閱