TaskAsyncEnumerableExtensions.WithCancellation<T>(IAsyncEnumerable<T>, CancellationToken) Método

Definição

Define o CancellationToken a ser passado para o GetAsyncEnumerator(CancellationToken) ao iterar.Sets the CancellationToken to be passed to GetAsyncEnumerator(CancellationToken) when iterating.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Runtime::CompilerServices::ConfiguredCancelableAsyncEnumerable<T> WithCancellation(System::Collections::Generic::IAsyncEnumerable<T> ^ source, System::Threading::CancellationToken cancellationToken);
public static System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T> (this System.Collections.Generic.IAsyncEnumerable<T> source, System.Threading.CancellationToken cancellationToken);
static member WithCancellation : System.Collections.Generic.IAsyncEnumerable<'T> * System.Threading.CancellationToken -> System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<'T>

Parâmetros de tipo

T

O tipo dos objetos a iterar.The type of the objects to iterate.

Parâmetros

source
IAsyncEnumerable<T>

A origem enumerável a ser iterada.The source enumerable to iterate.

cancellationToken
CancellationToken

O token de cancelamento a ser usado.The cancellation token to use.

Retornos

O enumerável configurado.The configured enumerable.

Aplica-se a