IAsyncEnumerableExtensionsWithAwaitConfiguredCancellationT Method

Sets the CancellationToken to be passed to GetAsyncEnumerator(CancellationToken) when iterating and configures how awaits on the tasks returned from an async iteration will be performed, defaults to not capturing.

Definition

Namespace: Gemstone.Collections.IAsyncEnumerableExtensions
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.166 -- Release Build+d3cb24a90fe44346300dfbb17444d7b350f42d79
public static ConfiguredCancelableAsyncEnumerable<T> WithAwaitConfiguredCancellation<T>(
	this IAsyncEnumerable<T> source,
	CancellationToken cancellationToken,
	bool continueOnCapturedContext = false
)

Parameters

source  IAsyncEnumerableT
The source enumerable being iterated.
cancellationToken  CancellationToken
The CancellationToken to use.
continueOnCapturedContext  Boolean  (Optional)
Whether to capture and marshal back to the current context.

Type Parameters

T
The type of the objects being iterated.

Return Value

ConfiguredCancelableAsyncEnumerableT
The configured enumerable.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAsyncEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

The WithCancellationT(IAsyncEnumerableT, CancellationToken) extension method sets continueOnCapturedContext to true, this extension method allows the to be set false, the default value for this extension method.

See Also