Language

AsyncEnumerable.ToArrayAsync Method

Definition

Creates an array from an IAsyncEnumerable.

public static System.Threading.Tasks.ValueTask ToArrayAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Threading.CancellationToken cancellationToken = default);
static member ToArrayAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Source[]>

Public Function ToArrayAsync(Of TSource) (source As IAsyncEnumerable(Of TSource), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TSource())

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable

An IEnumerable to create an array from.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

An array that contains the elements from the input sequence.

Exceptions

source is null.

Applies to