<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.9" />

TaskAsyncEnumerableExtensions

public static class TaskAsyncEnumerableExtensions
Provides a set of static methods for configuring Task-related behaviors on asynchronous enumerables and disposables.
using System.Collections.Generic; using System.Runtime.CompilerServices; namespace System.Threading.Tasks { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public static class TaskAsyncEnumerableExtensions { public static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable source, bool continueOnCapturedContext) { return new ConfiguredAsyncDisposable(source, continueOnCapturedContext); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<[System.Runtime.CompilerServices.Nullable(2)] T>(this IAsyncEnumerable<T> source, bool continueOnCapturedContext) { return new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext, default(CancellationToken)); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<[System.Runtime.CompilerServices.Nullable(2)] T>(this IAsyncEnumerable<T> source, CancellationToken cancellationToken) { return new ConfiguredCancelableAsyncEnumerable<T>(source, true, cancellationToken); } } }