Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

TaskAsyncEnumerableExtensions.WithCancellation<T> Method

Definition

Namespace:
System.Threading.Tasks
Assemblies:
netstandard.dll, System.Runtime.dll
Assembly:
System.Threading.Tasks.dll
Assembly:
Microsoft.Bcl.AsyncInterfaces.dll
Assembly:
netstandard.dll
Package:
Microsoft.Bcl.AsyncInterfaces v11.0.0-preview.5.26302.115
Source:
TaskAsyncEnumerableExtensions.cs
Source:
TaskAsyncEnumerableExtensions.cs
Source:
TaskAsyncEnumerableExtensions.cs
Source:
TaskAsyncEnumerableExtensions.cs
Source:
TaskAsyncEnumerableExtensions.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Sets the CancellationToken to be passed to GetAsyncEnumerator(CancellationToken) when iterating.

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) where T : allows ref struct;
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)

Type Parameters

T

The type of the objects being iterated.

Parameters

source
IAsyncEnumerable<T>

The source enumerable being iterated.

cancellationToken
CancellationToken

The CancellationToken to use.

Returns

The configured enumerable.

Applies to


Feedback

Was this page helpful?