TextWriter.WriteLineAsync TextWriter.WriteLineAsync TextWriter.WriteLineAsync TextWriter.WriteLineAsync Method

定義

以非同步方式將資料寫入文字資料流,後接行結束字元。Asynchronously writes data to the text stream, followed by a line terminator.

多載

WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken) WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken)

以非同步方式將字元記憶體區域的文字表示寫入文字資料流,後接行結束字元。Asynchronously writes the text representation of a character memory region to the text stream, followed by a line terminator.

WriteLineAsync(String) WriteLineAsync(String) WriteLineAsync(String) WriteLineAsync(String)

以非同步方式將字串寫入文字資料流,後接行結束字元。Asynchronously writes a string to the text stream, followed by a line terminator.

WriteLineAsync(Char[]) WriteLineAsync(Char[]) WriteLineAsync(Char[]) WriteLineAsync(Char[])

以非同步方式將字元的陣列寫入文字資料流,後接行結束字元。Asynchronously writes an array of characters to the text stream, followed by a line terminator.

WriteLineAsync(StringBuilder, CancellationToken) WriteLineAsync(StringBuilder, CancellationToken)

以非同步方式將字串產生器的文字表示寫入文字資料流,後接行結束字元。Asynchronously writes the text representation of a string builder to the text stream, followed by a line terminator.

WriteLineAsync() WriteLineAsync() WriteLineAsync() WriteLineAsync()

以非同步方式將行結束字元寫入文字資料流。Asynchronously writes a line terminator to the text stream.

WriteLineAsync(Char) WriteLineAsync(Char) WriteLineAsync(Char) WriteLineAsync(Char)

以非同步方式將字元寫入文字資料流,後接行結束字元。Asynchronously writes a character to the text stream, followed by a line terminator.

WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32)

以非同步方式將字元的子陣列寫入文字資料流,後接行結束字元。Asynchronously writes a subarray of characters to the text stream, followed by a line terminator.

備註

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

WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken) WriteLineAsync(ReadOnlyMemory<Char>, CancellationToken)

以非同步方式將字元記憶體區域的文字表示寫入文字資料流,後接行結束字元。Asynchronously writes the text representation of a character memory region to the text stream, followed by a line terminator.

public virtual System.Threading.Tasks.Task WriteLineAsync (ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = null);
abstract member WriteLineAsync : ReadOnlyMemory<char> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.WriteLineAsync : ReadOnlyMemory<char> * System.Threading.CancellationToken -> System.Threading.Tasks.Task

參數

buffer
ReadOnlyMemory<Char>

要寫入文字資料流的字元記憶體區域。The character memory region to write to the text stream.

cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

用來監視是否有取消要求的語彙基元。The token to monitor for cancellation requests. 預設值為 NoneThe default value is None.

傳回

表示非同步寫入作業的工作。A task that represents the asynchronous write operation.

備註

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

WriteLineAsync(String) WriteLineAsync(String) WriteLineAsync(String) WriteLineAsync(String)

以非同步方式將字串寫入文字資料流,後接行結束字元。Asynchronously writes a string to the text stream, followed by a line terminator.

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

參數

value
String String String String

要寫入的字串。The string to write. 如果值為 null,則只會寫入行結束字元。If the value is null, only a line terminator is written.

傳回

表示非同步寫入作業的工作。A task that represents the asynchronous write operation.

例外狀況

文字寫入器目前由先前寫入作業所使用。The text writer is currently in use by a previous write operation.

備註

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

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

另請參閱

WriteLineAsync(Char[]) WriteLineAsync(Char[]) WriteLineAsync(Char[]) WriteLineAsync(Char[])

以非同步方式將字元的陣列寫入文字資料流,後接行結束字元。Asynchronously writes an array of characters to the text stream, followed by a line terminator.

public:
 System::Threading::Tasks::Task ^ WriteLineAsync(cli::array <char> ^ buffer);
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.Tasks.Task WriteLineAsync (char[] buffer);
member this.WriteLineAsync : char[] -> System.Threading.Tasks.Task
Public Function WriteLineAsync (buffer As Char()) As Task

參數

buffer
Char[]

要寫入到文字資料流的字元陣列。The character array to write to the text stream. 如果字元陣列是 null,則只有行結束字元會被寫入。If the character array is null, only the line terminator is written.

傳回

表示非同步寫入作業的工作。A task that represents the asynchronous write operation.

例外狀況

文字寫入器目前由先前寫入作業所使用。The text writer is currently in use by a previous write operation.

備註

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

另請參閱

WriteLineAsync(StringBuilder, CancellationToken) WriteLineAsync(StringBuilder, CancellationToken)

以非同步方式將字串產生器的文字表示寫入文字資料流,後接行結束字元。Asynchronously writes the text representation of a string builder to the text stream, followed by a line terminator.

public virtual System.Threading.Tasks.Task WriteLineAsync (System.Text.StringBuilder value, System.Threading.CancellationToken cancellationToken = null);
abstract member WriteLineAsync : System.Text.StringBuilder * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.WriteLineAsync : System.Text.StringBuilder * System.Threading.CancellationToken -> System.Threading.Tasks.Task

參數

value
StringBuilder StringBuilder StringBuilder StringBuilder

作為字串產生器的字串,用於寫入文字資料流。The string, as a string builder, to write to the text stream.

cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

用來監視是否有取消要求的語彙基元。The token to monitor for cancellation requests. 預設值為 NoneThe default value is None.

傳回

表示非同步寫入作業的工作。A task that represents the asynchronous write operation.

備註

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

WriteLineAsync() WriteLineAsync() WriteLineAsync() WriteLineAsync()

以非同步方式將行結束字元寫入文字資料流。Asynchronously writes a line terminator to the text stream.

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

傳回

表示非同步寫入作業的工作。A task that represents the asynchronous write operation.

例外狀況

文字寫入器目前由先前寫入作業所使用。The text writer is currently in use by a previous write operation.

備註

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

另請參閱

WriteLineAsync(Char) WriteLineAsync(Char) WriteLineAsync(Char) WriteLineAsync(Char)

以非同步方式將字元寫入文字資料流,後接行結束字元。Asynchronously writes a character to the text stream, followed by a line terminator.

public:
 virtual System::Threading::Tasks::Task ^ WriteLineAsync(char value);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual System.Threading.Tasks.Task WriteLineAsync (char value);
abstract member WriteLineAsync : char -> System.Threading.Tasks.Task
override this.WriteLineAsync : char -> System.Threading.Tasks.Task
Public Overridable Function WriteLineAsync (value As Char) As Task

參數

value
Char Char Char Char

要寫入到文字資料流的字元。The character to write to the text stream.

傳回

表示非同步寫入作業的工作。A task that represents the asynchronous write operation.

例外狀況

文字寫入器目前由先前寫入作業所使用。The text writer is currently in use by a previous write operation.

備註

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

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

另請參閱

WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32) WriteLineAsync(Char[], Int32, Int32)

以非同步方式將字元的子陣列寫入文字資料流,後接行結束字元。Asynchronously writes a subarray of characters to the text stream, followed by a line terminator.

public:
 virtual System::Threading::Tasks::Task ^ WriteLineAsync(cli::array <char> ^ buffer, int index, int count);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual System.Threading.Tasks.Task WriteLineAsync (char[] buffer, int index, int count);
abstract member WriteLineAsync : char[] * int * int -> System.Threading.Tasks.Task
override this.WriteLineAsync : char[] * int * int -> System.Threading.Tasks.Task
Public Overridable Function WriteLineAsync (buffer As Char(), index As Integer, count As Integer) As Task

參數

buffer
Char[]

資料寫入來源的字元陣列。The character array to write data from.

index
Int32 Int32 Int32 Int32

緩衝區中要開始擷取資料的字元位置。The character position in the buffer at which to start retrieving data.

count
Int32 Int32 Int32 Int32

要寫入的字元數。The number of characters to write.

傳回

表示非同步寫入作業的工作。A task that represents the asynchronous write operation.

例外狀況

index 加上 count 大於緩衝區長度。The index plus count is greater than the buffer length.

文字寫入器目前由先前寫入作業所使用。The text writer is currently in use by a previous write operation.

備註

行結束字元是由 CoreNewLine 欄位所定義。The line terminator is defined by the CoreNewLine field.

另請參閱

適用於