TaskAsyncEnumerableExtensions.ToBlockingEnumerable Method (System.Threading.Tasks) (original) (raw)

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.Collections.Generic.IEnumerable<T> ToBlockingEnumerable<T>(this System.Collections.Generic.IAsyncEnumerable<T> source, System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member ToBlockingEnumerable : System.Collections.Generic.IAsyncEnumerable<'T> * System.Threading.CancellationToken -> seq<'T>
<Extension()>
Public Function ToBlockingEnumerable(Of T) (source As IAsyncEnumerable(Of T), Optional cancellationToken As CancellationToken = Nothing) As IEnumerable(Of T)

Type Parameters

T

The type of the objects being iterated.

Parameters

Returns

An IEnumerable instance that enumerates the source IAsyncEnumerable in a blocking manner.

Attributes

Remarks

This method is implemented by using deferred execution. The underlying IAsyncEnumerable will not be enumerated unless the returned IEnumerable is enumerated by calling its GetEnumerator() method. Async enumeration does not happen in the background; each MoveNext call will invoke the underlying MoveNextAsync() exactly once.

Applies to