Table of Contents

WriteAllAsync Method

Definition

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

WriteAllAsync(IDecorator<Stream>, byte[], CancellationToken)

Asynchronously writes a sequence of bytes to the enclosed Stream of the decorator with the entire size of the buffer starting from position 0.

public static Task WriteAllAsync(this IDecorator<Stream> decorator, byte[] buffer, CancellationToken ct = default)

Parameters

decorator IDecorator<Stream>

The IDecorator<T> 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

decorator is null -or- buffer is null.

NotSupportedException

The enclosed Stream of decorator does not support writing.

ObjectDisposedException

The enclosed Stream of decorator has been disposed.

InvalidOperationException

The enclosed Stream of decorator is currently in use by a previous write operation.