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

RunTimeAspectHelper.BufferToListAsync Method

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

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

Declaration
public static ValueTask<AsyncEnumerableList<T>> BufferToListAsync<T>(this IAsyncEnumerator<T> enumerator, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IAsyncEnumerator<T> enumerator

An enumerator.

CancellationToken cancellationToken

A cancellation token.

Returns
Type Description
ValueTask<AsyncEnumerableList<T>>

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

Type Parameters
Name Description
T