Partilhar via


TaskAsyncEnumerableExtensions.WithCancellation<T> Método

Definição

Define o CancellationToken a ser passado para GetAsyncEnumerator(CancellationToken) ao iterar.

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>
<Extension()>
Public Function WithCancellation(Of T) (source As IAsyncEnumerable(Of T), cancellationToken As CancellationToken) As ConfiguredCancelableAsyncEnumerable(Of T)

Parâmetros de tipo

T

O tipo dos objetos que estão sendo iterados.

Parâmetros

source
IAsyncEnumerable<T>

A origem enumerável que está sendo iterada.

cancellationToken
CancellationToken

O CancellationToken a ser usado.

Retornos

O enumerável configurado.

Aplica-se a