Open sandboxFocus

Method AsAsyncEnumerator

AsAsyncEnumerator<T>(Task<IAsyncEnumerator<T>?>)

If task is already completed, returns the result of the task; otherwise, returns an instance of IAsyncEnumerator<T> which awaits the task in MoveNextAsync() then delegates to the enumerator from the result of the task.

Declaration
public static IAsyncEnumerator<T>? AsAsyncEnumerator<T>(this Task<IAsyncEnumerator<T>?> task)
Parameters
Type Name Description
Task<IAsyncEnumerator<T>> task
Returns
Type Description
IAsyncEnumerator<T>
Type Parameters
Name Description
T

AsAsyncEnumerator<T>(ValueTask<IAsyncEnumerator<T>?>)

If task is already completed, returns the result of the task; otherwise, returns an instance of IAsyncEnumerator<T> which awaits the task in MoveNextAsync() then delegates to the enumerator from the result of the task.

Declaration
public static IAsyncEnumerator<T>? AsAsyncEnumerator<T>(this ValueTask<IAsyncEnumerator<T>?> task)
Parameters
Type Name Description
ValueTask<IAsyncEnumerator<T>> task
Returns
Type Description
IAsyncEnumerator<T>
Type Parameters
Name Description
T