Table of Contents

WriteAllAsync Method

Definition

Namespace
Cuemon.Extensions.IO
Assemblies
Cuemon.Extensions.IO.dll
Source
src/Cuemon.Extensions.IO/StreamExtensions.cs

WriteAllAsync(Stream, byte[], CancellationToken)

Asynchronously writes a sequence of bytes to the current stream with the entire size of the buffer starting from position 0.

public static Task WriteAllAsync(this Stream stream, byte[] buffer, CancellationToken ct = default)

Parameters

stream Stream

The Stream to extend.

buffer byte[]

The buffer to write data from.

ct CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous write operation.

Exceptions

ArgumentNullException

stream is null -or- buffer is null.

NotSupportedException

The stream does not support writing.

ObjectDisposedException

The stream has been disposed.

InvalidOperationException

The stream is currently in use by a previous write operation.