Edit

Share via


StreamExtensions.WriteAsync Method

Definition

Caution

This API is only available for binary compatibility, but Stream.WriteAsync should be used instead.

Asynchronously writes a sequence of bytes to a given Stream instance.

[System.Obsolete("This API is only available for binary compatibility, but Stream.WriteAsync should be used instead.")]
public static System.Threading.Tasks.ValueTask WriteAsync(this System.IO.Stream stream, ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.ValueTask WriteAsync(this System.IO.Stream stream, ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default);
[<System.Obsolete("This API is only available for binary compatibility, but Stream.WriteAsync should be used instead.")>]
static member WriteAsync : System.IO.Stream * ReadOnlyMemory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
static member WriteAsync : System.IO.Stream * ReadOnlyMemory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsync (stream As Stream, buffer As ReadOnlyMemory(Of Byte), Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Parameters

stream
Stream

The destination Stream to write data to.

buffer
ReadOnlyMemory<Byte>

The source ReadOnlyMemory<T> to read data from.

cancellationToken
CancellationToken

The optional CancellationToken for the operation.

Returns

A ValueTask representing the operation being performed.

Attributes

Applies to