MetalamaAPI documentationPatterns APIMetalama.​Patterns.​Caching.​Aspects.​HelpersAsync­Enumerable­HelperAs­Async­Enumerator
Open sandboxFocus

AsyncEnumerableHelper.AsAsyncEnumerator Method

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

If task is already completed, returns the result of the task; otherwise, returns an instance of System.Collections.Generic.IAsyncEnumerator<> 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
System.Threading.Tasks.Task<System.Collections.Generic.IAsyncEnumerator<T>> task
Returns
Type Description
System.Collections.Generic.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 System.Collections.Generic.IAsyncEnumerator<> 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
System.Threading.Tasks.ValueTask<System.Collections.Generic.IAsyncEnumerator<T>> task
Returns
Type Description
System.Collections.Generic.IAsyncEnumerator<T>
Type Parameters
Name Description
T