MetalamaAPI documentationAspect APIMetalama.​Framework.​Run­TimeRun­Time­Aspect­HelperBuffer­Async
Open sandboxFocus

RunTimeAspectHelper.BufferAsync Method

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

Evaluates an System.Collections.Generic.IAsyncEnumerable<> 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 = null)
Parameters
Type Name Description
System.Collections.Generic.IAsyncEnumerable<T> enumerable

An enumerable.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.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 System.Collections.Generic.IAsyncEnumerator<>, 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 = null)
Parameters
Type Name Description
System.Collections.Generic.IAsyncEnumerator<T> enumerator

An enumerator.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.ValueTask<AsyncEnumerableList.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