Open sandboxFocus

Method BufferAsync

BufferAsync<T>(IAsyncEnumerable<T>, CancellationToken)

Evaluates an IAsyncEnumerable<T> and stores the result into an AsyncEnumerableList<T>. If the enumerable is already an AsyncEnumerableList<T>, returns the input list. The intended side effect of this method is to completely evaluate the input enumerable.

Declaration
public static ValueTask<AsyncEnumerableList<T>> BufferAsync<T>(this IAsyncEnumerable<T> enumerable, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IAsyncEnumerable<T> enumerable

An enumerable.

CancellationToken cancellationToken
Returns
Type Description
ValueTask<AsyncEnumerableList<T>>

A AsyncEnumerableList<T> made from the items of enumerable, or the enumerable object itself it is already an AsyncEnumerableList<T>.

Type Parameters
Name Description
T

BufferAsync<T>(IAsyncEnumerator<T>, CancellationToken)

Evaluates an IAsyncEnumerator<T>, stores the result into an AsyncEnumerableList<T> and returns an enumerator for this object. If the enumerator is already an AsyncEnumerableList<T> enumerator, returns the input enumerator. The intended side effect of this method is to completely evaluate the input enumerator.

Declaration
public static ValueTask<AsyncEnumerableList<T>.AsyncEnumerator> BufferAsync<T>(this IAsyncEnumerator<T> enumerator, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IAsyncEnumerator<T> enumerator

An enumerator.

CancellationToken cancellationToken
Returns
Type Description
ValueTask<AsyncEnumerableList<T>.AsyncEnumerator>

An enumerator on a AsyncEnumerableList<T> made from the items of enumerator, or the enumerator object itself it is already an AsyncEnumerableList<T> enumerator.

Type Parameters
Name Description
T