Muokkaa

Jaa


ChannelReader<T>.ReadAllAsync(CancellationToken) Method

Definition

Creates an IAsyncEnumerable<T> that enables reading all of the data from the channel.

public virtual System.Collections.Generic.IAsyncEnumerable<T> ReadAllAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member ReadAllAsync : System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'T>
override this.ReadAllAsync : System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'T>
Public Overridable Function ReadAllAsync (Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of T)

Parameters

cancellationToken
CancellationToken

The cancellation token to use to cancel the enumeration. If data is immediately ready for reading, then that data may be yielded even after cancellation has been requested.

Returns

The created async enumerable.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

Each MoveNextAsync() call that returns true will read the next item out of the channel.

MoveNextAsync() returns false once no more data is or will ever be available to read.

Applies to