ConfiguredCancelableAsyncEnumerable<T>.WithCancellation(CancellationToken) 方法
定义
设置要在循环访问时传递到 GetAsyncEnumerator(CancellationToken) 的 CancellationToken。Sets the CancellationToken to be passed to GetAsyncEnumerator(CancellationToken) when iterating.
public:
System::Runtime::CompilerServices::ConfiguredCancelableAsyncEnumerable<T> WithCancellation(System::Threading::CancellationToken cancellationToken);
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> WithCancellation (System.Threading.CancellationToken cancellationToken);
member this.WithCancellation : System.Threading.CancellationToken -> System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<'T>
Public Function WithCancellation (cancellationToken As CancellationToken) As ConfiguredCancelableAsyncEnumerable(Of T)
参数
- cancellationToken
- CancellationToken
要使用的取消标记。The cancellation token to use.
返回
配置的可枚举项。The configured enumerable.
注解
这将 CancellationToken WithCancellation(CancellationToken) 为此迭代替换以前的设置。This will replace any previous CancellationToken set by WithCancellation(CancellationToken) for this iteration.