TaskAsyncEnumerableExtensions.WithCancellation<T> Méthode

Définition

Définit le CancellationToken à passer à GetAsyncEnumerator(CancellationToken) lors de l’itération.

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)

Paramètres de type

T

Type des objets à itérer.

Paramètres

source
IAsyncEnumerable<T>

Énumérable source sur lequel boucler.

cancellationToken
CancellationToken

Jeton d’annulation à utiliser.

Retours

ConfiguredCancelableAsyncEnumerable<T>

Énumérable configuré.

S’applique à