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

返回

配置的可枚举。

适用于