Delen via


AsyncEnumerable<TResult>.ToArrayAsync(CancellationToken) Method

Definition

Asynchronously creates an array from this AsyncEnumerable<TResult>.

public System.Threading.Tasks.Task<TResult[]> ToArrayAsync (System.Threading.CancellationToken cancellationToken = default);
member this.ToArrayAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result[]>
Public Function ToArrayAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of TResult())

Parameters

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<TResult[]>

A task that represents the asynchronous operation. The task result contains an array that contains elements from the input sequence.

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to