共用方式為


TaskAsyncEnumerableExtensions.WithCancellation<T> 方法

定義

設定反覆運算時要傳遞至 GetAsyncEnumerator(CancellationToken)CancellationToken

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)

類型參數

T

要進行之物件的類型。

參數

source
IAsyncEnumerable<T>

正在反覆運算的來源可列舉。

cancellationToken
CancellationToken

要使用的 CancellationToken

傳回

已設定的可列舉。

適用於