Condividi tramite


TextWriter.WriteAsync Metodo

Definizione

Scrive i dati nel flusso di testo in modo asincrono.

Overload

Nome Descrizione
WriteAsync(String, CancellationToken)
WriteAsync(Char[], Int32, Int32)

Scrive una sottomaschera di caratteri nel flusso di testo in modo asincrono.

WriteAsync(StringBuilder, CancellationToken)

Scrive in modo asincrono un generatore di stringhe nel flusso di testo.

WriteAsync(ReadOnlyMemory<Char>, CancellationToken)

Scrive in modo asincrono un'area di memoria di caratteri nel flusso di testo.

WriteAsync(Char)

Scrive un carattere nel flusso di testo in modo asincrono.

WriteAsync(String)

Scrive una stringa nel flusso di testo in modo asincrono.

WriteAsync(Char[])

Scrive una matrice di caratteri nel flusso di testo in modo asincrono.

WriteAsync(Rune)

WriteAsync(String, CancellationToken)

public:
 System::Threading::Tasks::Task ^ WriteAsync(System::String ^ value, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task WriteAsync(string? value, System.Threading.CancellationToken cancellationToken);
member this.WriteAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WriteAsync (value As String, cancellationToken As CancellationToken) As Task

Parametri

value
String
cancellationToken
CancellationToken

Restituisce

Si applica a

WriteAsync(Char[], Int32, Int32)

Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs

Scrive una sottomaschera di caratteri nel flusso di testo in modo asincrono.

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

Parametri

buffer
Char[]

Matrice di caratteri da cui scrivere i dati.

index
Int32

Posizione del carattere nel buffer in cui iniziare a recuperare i dati.

count
Int32

Numero di caratteri da scrivere.

Restituisce

Attività che rappresenta l'operazione di scrittura asincrona.

Attributi

Eccezioni

buffer è null.

Il index segno più count è maggiore della lunghezza del buffer.

index o count è negativo.

Il writer di testo viene eliminato.

Il writer di testo è attualmente in uso da un'operazione di scrittura precedente.

Commenti

La TextWriter classe è una classe astratta. Di conseguenza, non è necessario crearne un'istanza nel codice. Per un esempio di utilizzo del WriteAsync metodo , vedere il StreamWriter.WriteAsync metodo .

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da Write(Char[], Int32, Int32).

Vedi anche

Si applica a

WriteAsync(StringBuilder, CancellationToken)

Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs

Scrive in modo asincrono un generatore di stringhe nel flusso di testo.

public virtual System.Threading.Tasks.Task WriteAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default);
abstract member WriteAsync : System.Text.StringBuilder * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.WriteAsync : System.Text.StringBuilder * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function WriteAsync (value As StringBuilder, Optional cancellationToken As CancellationToken = Nothing) As Task

Parametri

value
StringBuilder

Stringa, come generatore di stringhe, da scrivere nel flusso di testo.

cancellationToken
CancellationToken

Token da monitorare per le richieste di annullamento. Il valore predefinito è None.

Restituisce

Attività che rappresenta l'operazione di scrittura asincrona.

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Commenti

Questo metodo equivale a chiamare WriteAsync(stringBuilder.ToString()), ma usa il StringBuilder.GetChunks() metodo per evitare di creare la stringa intermedia.

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da Write(StringBuilder).

Si applica a

WriteAsync(ReadOnlyMemory<Char>, CancellationToken)

Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs

Scrive in modo asincrono un'area di memoria di caratteri nel flusso di testo.

public virtual System.Threading.Tasks.Task WriteAsync(ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default);
abstract member WriteAsync : ReadOnlyMemory<char> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.WriteAsync : ReadOnlyMemory<char> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function WriteAsync (buffer As ReadOnlyMemory(Of Char), Optional cancellationToken As CancellationToken = Nothing) As Task

Parametri

buffer
ReadOnlyMemory<Char>

Area di memoria dei caratteri da scrivere nel flusso di testo.

cancellationToken
CancellationToken

Token da monitorare per le richieste di annullamento. Il valore predefinito è None.

Restituisce

Attività che rappresenta l'operazione di scrittura asincrona.

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Si applica a

WriteAsync(Char)

Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs

Scrive un carattere nel flusso di testo in modo asincrono.

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

Parametri

value
Char

Carattere da scrivere nel flusso di testo.

Restituisce

Attività che rappresenta l'operazione di scrittura asincrona.

Attributi

Eccezioni

Il writer di testo viene eliminato.

Il writer di testo è attualmente in uso da un'operazione di scrittura precedente.

Commenti

La TextWriter classe è una classe astratta. Di conseguenza, non è necessario crearne un'istanza nel codice. Per un esempio di utilizzo del WriteAsync metodo , vedere il StreamWriter.WriteAsync metodo .

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da Write(Char).

Vedi anche

Si applica a

WriteAsync(String)

Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs

Scrive una stringa nel flusso di testo in modo asincrono.

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

Parametri

value
String

Stringa da scrivere. Se value è null, non viene scritto nulla nel flusso di testo.

Restituisce

Attività che rappresenta l'operazione di scrittura asincrona.

Attributi

Eccezioni

Il writer di testo viene eliminato.

Il writer di testo è attualmente in uso da un'operazione di scrittura precedente.

Commenti

La TextWriter classe è una classe astratta. Di conseguenza, non è necessario crearne un'istanza nel codice. Per un esempio di utilizzo del WriteAsync metodo , vedere il StreamWriter.WriteAsync metodo .

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da Write(String).

Vedi anche

Si applica a

WriteAsync(Char[])

Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs
Origine:
TextWriter.cs

Scrive una matrice di caratteri nel flusso di testo in modo asincrono.

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

Parametri

buffer
Char[]

Matrice di caratteri da scrivere nel flusso di testo. Se buffer è null, non viene scritto nulla.

Restituisce

Attività che rappresenta l'operazione di scrittura asincrona.

Attributi

Eccezioni

Il writer di testo viene eliminato.

Il writer di testo è attualmente in uso da un'operazione di scrittura precedente.

Commenti

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da Write(Char[]).

Vedi anche

Si applica a

WriteAsync(Rune)

public:
 virtual System::Threading::Tasks::Task ^ WriteAsync(System::Text::Rune value);
public virtual System.Threading.Tasks.Task WriteAsync(System.Text.Rune value);
abstract member WriteAsync : System.Text.Rune -> System.Threading.Tasks.Task
override this.WriteAsync : System.Text.Rune -> System.Threading.Tasks.Task
Public Overridable Function WriteAsync (value As Rune) As Task

Parametri

value
Rune

Restituisce

Si applica a