Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Asynchronously writes data to the text stream, followed by a line terminator.
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) |
Asynchronously writes a string to the text stream, followed by a line terminator. |
WriteLineAsync(Char[]) |
Asynchronously writes an array of characters to the text stream, followed by a line terminator. |
WriteLineAsync(Char[], Int32, Int32) |
Asynchronously writes a subarray of characters to the text stream, followed by a line terminator. |
WriteLineAsync() |
Asynchronously writes a line terminator to the text stream. |
WriteLineAsync(StringBuilder, CancellationToken) |
Asynchronously writes the text representation of a string builder to the text stream, followed by a line terminator. |
WriteLineAsync(Char) |
Asynchronously writes a character to the text stream, followed by a line terminator. |
The TextWriter class is an abstract class. Therefore, you do not instantiate it in your code. For an example of using the WriteLineAsync method, see the StreamWriter.WriteLineAsync method.
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 = default);
abstract member WriteLineAsync : ReadOnlyMemory<char> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.WriteLineAsync : ReadOnlyMemory<char> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function WriteLineAsync (buffer As ReadOnlyMemory(Of Char), Optional cancellationToken As CancellationToken = Nothing) As Task
The character memory region to write to the text stream.
The token to monitor for cancellation requests. The default value is None.
A task that represents the asynchronous write operation.
The cancellation token was canceled. This exception is stored into the returned task.
The line terminator is defined by the CoreNewLine field.
Product | Versions |
---|---|
.NET | Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Standard | 2.1 |
Asynchronously writes a string to the text stream, followed by a line terminator.
public:
virtual System::Threading::Tasks::Task ^ WriteLineAsync(System::String ^ value);
public virtual System.Threading.Tasks.Task WriteLineAsync(string value);
public virtual System.Threading.Tasks.Task WriteLineAsync(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
[<System.Runtime.InteropServices.ComVisible(false)>]
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
The string to write. If the value is null
, only a line terminator is written.
A task that represents the asynchronous write operation.
The text writer is disposed.
The text writer is currently in use by a previous write operation.
The line terminator is defined by the CoreNewLine field.
The TextWriter class is an abstract class. Therefore, you do not instantiate it in your code. For an example of using the WriteLineAsync method, see the StreamWriter.WriteLineAsync method.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteLine(String).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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);
public System.Threading.Tasks.Task WriteLineAsync(char[] buffer);
public System.Threading.Tasks.Task WriteLineAsync(char[]? buffer);
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.Tasks.Task WriteLineAsync(char[] buffer);
member this.WriteLineAsync : char[] -> System.Threading.Tasks.Task
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.WriteLineAsync : char[] -> System.Threading.Tasks.Task
Public Function WriteLineAsync (buffer As Char()) As Task
The character array to write to the text stream. If the character array is null
, only the line terminator is written.
A task that represents the asynchronous write operation.
The text writer is disposed.
The text writer is currently in use by a previous write operation.
The line terminator is defined by the CoreNewLine field.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteLine(Char[]).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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);
public virtual System.Threading.Tasks.Task WriteLineAsync(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
[<System.Runtime.InteropServices.ComVisible(false)>]
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
The character array to write data from.
The character position in the buffer at which to start retrieving data.
The number of characters to write.
A task that represents the asynchronous write operation.
buffer
is null
.
The index
plus count
is greater than the buffer length.
index
or count
is negative.
The text writer is disposed.
The text writer is currently in use by a previous write operation.
The line terminator is defined by the CoreNewLine field.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteLine(Char[], Int32, Int32).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
Asynchronously writes a line terminator to the text stream.
public:
virtual System::Threading::Tasks::Task ^ WriteLineAsync();
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
[<System.Runtime.InteropServices.ComVisible(false)>]
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 disposed.
The text writer is currently in use by a previous write operation.
The line terminator is defined by the CoreNewLine field.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteLine().
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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 = default);
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
Public Overridable Function WriteLineAsync (value As StringBuilder, Optional cancellationToken As CancellationToken = Nothing) As Task
The string, as a string builder, to write to the text stream.
The token to monitor for cancellation requests. The default value is None.
A task that represents the asynchronous write operation.
The cancellation token was canceled. This exception is stored into the returned task.
The line terminator is defined by the CoreNewLine field.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteLine(StringBuilder).
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
Asynchronously writes a character to the text stream, followed by a line terminator.
public:
virtual System::Threading::Tasks::Task ^ WriteLineAsync(char value);
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
[<System.Runtime.InteropServices.ComVisible(false)>]
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
The character to write to the text stream.
A task that represents the asynchronous write operation.
The text writer is disposed.
The text writer is currently in use by a previous write operation.
The line terminator is defined by the CoreNewLine field.
The TextWriter class is an abstract class. Therefore, you do not instantiate it in your code. For an example of using the WriteLineAsync method, see the StreamWriter.WriteLineAsync method.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteLine(Char).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Please sign in to use this experience.
Sign in