Sdílet prostřednictvím


TaskAsyncEnumerableExtensions.WithCancellation<T> Metoda

Definice

Nastaví CancellationToken, která se má předat GetAsyncEnumerator(CancellationToken) při iteraci.

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)

Parametry typu

T

Typ objektu, který se iterated.

Parametry

source
IAsyncEnumerable<T>

Zdrojový výčet se dá itestrovat.

cancellationToken
CancellationToken

CancellationToken, která se má použít.

Návraty

Nakonfigurovaný výčet.

Platí pro