// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT License. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace System.Linq { partial class AsyncEnumerable { #if SUPPORT_FLAT_ASYNC_API public static ValueTask FirstAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstAwaitAsyncCore(source, predicate, cancellationToken); public static ValueTask FirstOrDefaultAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstOrDefaultAwaitAsyncCore(source, predicate, cancellationToken); public static Task ForEachAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken = default) => ForEachAwaitAsyncCore(source, action, cancellationToken); public static Task ForEachAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken = default) => ForEachAwaitAsyncCore(source, action, cancellationToken); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector) => GroupByAwaitCore(source, keySelector); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, comparer); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector) => GroupByAwaitCore(source, keySelector, elementSelector); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func, ValueTask> resultSelector) => GroupByAwaitCore(source, keySelector, resultSelector); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, ValueTask> resultSelector) => GroupByAwaitCore(source, keySelector, elementSelector, resultSelector); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, elementSelector, comparer); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, resultSelector, comparer); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, elementSelector, resultSelector, comparer); public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, ValueTask> resultSelector) => GroupJoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, ValueTask> resultSelector, IEqualityComparer comparer) => GroupJoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector) => JoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector, IEqualityComparer comparer) => JoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); public static ValueTask LastAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastAwaitAsyncCore(source, predicate, cancellationToken); public static ValueTask LastOrDefaultAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastOrDefaultAwaitAsyncCore(source, predicate, cancellationToken); public static ValueTask LongCountAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LongCountAwaitAsyncCore(source, predicate, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func> keySelector) => OrderByAwaitCore(source, keySelector); public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByAwaitCore(source, keySelector, comparer); public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func> keySelector) => OrderByDescendingAwaitCore(source, keySelector); public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByDescendingAwaitCore(source, keySelector, comparer); public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func> selector) => SelectAwaitCore(source, selector); public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func> selector) => SelectAwaitCore(source, selector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitCore(source, selector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitCore(source, selector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitCore(source, collectionSelector, resultSelector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitCore(source, collectionSelector, resultSelector); public static ValueTask SingleAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleAwaitAsyncCore(source, predicate, cancellationToken); public static ValueTask SingleOrDefaultAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleOrDefaultAwaitAsyncCore(source, predicate, cancellationToken); public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitCore(source, predicate); public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitCore(source, predicate); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitCore(source, predicate); public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitCore(source, predicate); public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByAwaitCore(source, keySelector); public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByAwaitCore(source, keySelector, comparer); public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByDescendingAwaitCore(source, keySelector); public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByDescendingAwaitCore(source, keySelector, comparer); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, cancellationToken); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, comparer, cancellationToken); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, elementSelector, cancellationToken); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, elementSelector, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, comparer, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func> predicate) => WhereAwaitCore(source, predicate); public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func> predicate) => WhereAwaitCore(source, predicate); public static IAsyncEnumerable Zip(this IAsyncEnumerable first, IAsyncEnumerable second, Func> selector) => ZipAwaitCore(first, second, selector); #if !NO_DEEP_CANCELLATION public static ValueTask FirstAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask FirstOrDefaultAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstOrDefaultAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static Task ForEachAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken) => ForEachAwaitWithCancellationAsyncCore(source, action, cancellationToken); public static Task ForEachAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken) => ForEachAwaitWithCancellationAsyncCore(source, action, cancellationToken); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector) => GroupByAwaitWithCancellationCore(source, keySelector); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, comparer); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func, CancellationToken, ValueTask> resultSelector) => GroupByAwaitWithCancellationCore(source, keySelector, resultSelector); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, CancellationToken, ValueTask> resultSelector) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector, resultSelector); public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector, comparer); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func, CancellationToken, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, resultSelector, comparer); public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, CancellationToken, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector, resultSelector, comparer); public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, CancellationToken, ValueTask> resultSelector) => GroupJoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, CancellationToken, ValueTask> resultSelector, IEqualityComparer comparer) => GroupJoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector) => JoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector, IEqualityComparer comparer) => JoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); public static ValueTask LastAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask LastOrDefaultAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastOrDefaultAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask LongCountAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LongCountAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func> keySelector) => OrderByAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByAwaitWithCancellationCore(source, keySelector, comparer); public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func> keySelector) => OrderByDescendingAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByDescendingAwaitWithCancellationCore(source, keySelector, comparer); public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func> selector) => SelectAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func> selector) => SelectAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitWithCancellationCore(source, collectionSelector, resultSelector); public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitWithCancellationCore(source, collectionSelector, resultSelector); public static ValueTask SingleAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask SingleOrDefaultAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleOrDefaultAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitWithCancellationCore(source, predicate); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitWithCancellationCore(source, predicate); public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByAwaitWithCancellationCore(source, keySelector, comparer); public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByDescendingAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByDescendingAwaitWithCancellationCore(source, keySelector, comparer); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, cancellationToken); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, comparer, cancellationToken); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, cancellationToken); public static ValueTask> ToDictionaryAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, comparer, cancellationToken); public static ValueTask> ToLookupAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func> predicate) => WhereAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func> predicate) => WhereAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable Zip(this IAsyncEnumerable first, IAsyncEnumerable second, Func> selector) => ZipAwaitWithCancellationCore(first, second, selector); #endif #else /// /// Returns the first element of an async-enumerable sequence that satisfies the condition in the predicate. /// /// The type of elements in the sequence. /// Source async-enumerable sequence. /// An asynchronous predicate that will be invoked and awaited for each element in the sequence. /// An optional cancellation token for cancelling the sequence at any time. /// A ValueTask containing the first element in the sequence that satisfies the predicate. /// or is . /// No element satisfies the condition in the predicate. -or- The source sequence is empty. public static ValueTask FirstAwaitAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstAwaitAsyncCore(source, predicate, cancellationToken); /// /// Returns the first element of an async-enumerable sequence that satisfies the condition in the predicate, or a default value if no element satisfies the condition in the predicate. /// /// The type of element in the sequence. /// Source async-enumerable sequence. /// An asynchronous predicate to invoke and await on each element of the sequence. /// An optional cancellation token for cancelling the sequence at any time. /// A ValueTask containing the first element in the sequence that satisfies the predicate, or a default value if no element satisfies the predicate. /// or is . public static ValueTask FirstOrDefaultAwaitAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstOrDefaultAwaitAsyncCore(source, predicate, cancellationToken); /// /// Invokes and awaits an asynchronous action on each element in the source sequence, and returns a task that is signaled when the sequence terminates. /// /// Type of elements in the sequence. /// Source sequence. /// Asynchronous action to invoke and await for each element in the source sequence. /// Optional cancellation token for cancelling the sequence at any time. /// Task that signals the termination of the sequence. /// or is . public static Task ForEachAwaitAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken = default) => ForEachAwaitAsyncCore(source, action, cancellationToken); /// /// Invokes and awaits an asynchronous action on each element in the source sequence, incorporating the element's index, and returns a task that is signaled when the sequence terminates. /// /// Type of elements in the sequence. /// Source sequence. /// Asynchronous action to invoke and await for each element in the source sequence; the second parameter represents the index of the element. /// Optional cancellation token for cancelling the sequence at any time. /// Task that signals the termination of the sequence. /// or is . public static Task ForEachAwaitAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken = default) => ForEachAwaitAsyncCore(source, action, cancellationToken); /// /// Groups the elements of an async-enumerable sequence according to a specified key selector function. /// /// The type of the elements in the source sequence. /// The type of the grouping key computed for each element in the source sequence. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// A sequence of async-enumerable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. /// or is . public static IAsyncEnumerable> GroupByAwait(this IAsyncEnumerable source, Func> keySelector) => GroupByAwaitCore(source, keySelector); /// /// Groups the elements of an async-enumerable sequence according to a specified key selector function and comparer. /// /// The type of the elements in the source sequence. /// The type of the grouping key computed for each element in the source sequence. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// An equality comparer to compare keys with. /// A sequence of async-enumerable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. /// or or is . public static IAsyncEnumerable> GroupByAwait(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, comparer); /// /// Groups the elements of an async-enumerable sequence and selects the resulting elements by using a specified function. /// /// The type of the elements in the source sequence. /// The type of the grouping key computed for each element in the source sequence. /// The type of the elements within the groups computed for each element in the source sequence. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// An asynchronous function to map each source element to an element in an async-enumerable group. /// A sequence of async-enumerable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. /// or or is . public static IAsyncEnumerable> GroupByAwait(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector) => GroupByAwaitCore(source, keySelector, elementSelector); /// /// Groups the elements of an async-enumerable sequence according to a specified key selector function, and then applies a result selector function to each group. /// /// Type of element in the source sequence. /// Type of the grouping key computed for each element in the source sequence. /// The result type returned by the result selector function. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// An asynchronous function to transform each group into the result type. /// An async-enumerable sequence of results obtained by invoking and awaiting the result-selector function on each group. /// or or is . public static IAsyncEnumerable GroupByAwait(this IAsyncEnumerable source, Func> keySelector, Func, ValueTask> resultSelector) => GroupByAwaitCore(source, keySelector, resultSelector); /// /// Groups the elements of an async-enumerable sequence according to a specified key-selector function, applies an element selector to each element of each group, then applies a result selector to each transformed group. /// /// The type of element in the source sequence. /// The type of the grouping key computed for each element in the source sequence. /// The type of element computed by the element selector. /// The type of the final result, computed by applying the result selector to each transformed group of elements. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// An asynchronous function to apply to each element of each group. /// An asynchronous function to transform each group into the result type. /// An async-enumerable sequence of results obtained by invoking the result selector function on each group and awaiting the result. /// or or or is . public static IAsyncEnumerable GroupByAwait(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, ValueTask> resultSelector) => GroupByAwaitCore(source, keySelector, elementSelector, resultSelector); /// /// Groups the elements of an async-enumerable sequence and selects the resulting elements by using a specified function. /// /// The type of the elements in the source sequence. /// The type of the grouping key computed for each element in the source sequence. /// The type of the elements within the groups computed for each element in the source sequence. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// An asynchronous function to map each source element to an element in an async-enumerable group. /// An equality comparer to use to compare keys. /// A sequence of async-enumerable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. /// or or or is . public static IAsyncEnumerable> GroupByAwait(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, elementSelector, comparer); /// /// Groups the elements of an async-enumerable sequence according to a specified key selector function, and then applies a result selector function to each group. /// /// Type of element in the source sequence. /// Type of the grouping key computed for each element in the source sequence. /// The result type returned by the result selector function. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// An asynchronous function to transform each group into the result type. /// An equality comparer to use to compare keys. /// An async-enumerable sequence of results obtained by invoking and awaiting the result-selector function on each group. /// or or or is . public static IAsyncEnumerable GroupByAwait(this IAsyncEnumerable source, Func> keySelector, Func, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, resultSelector, comparer); /// /// Groups the elements of an async-enumerable sequence according to a specified key-selector function, applies an element selector to each element of each group, then applies a result selector to each transformed group. /// /// The type of element in the source sequence. /// The type of the grouping key computed for each element in the source sequence. /// The type of element computed by the element selector. /// The type of the final result, computed by applying the result selector to each transformed group of elements. /// An async-enumerable sequence whose elements to group. /// An asynchronous function to extract the key for each element. /// An asynchronous function to apply to each element of each group. /// An asynchronous function to transform each group into the result type. /// An equality comparer to use to compare keys. /// An async-enumerable sequence of results obtained by invoking the result selector function on each group and awaiting the result. /// or or or or is . public static IAsyncEnumerable GroupByAwait(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitCore(source, keySelector, elementSelector, resultSelector, comparer); public static IAsyncEnumerable GroupJoinAwait(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, ValueTask> resultSelector) => GroupJoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable GroupJoinAwait(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, ValueTask> resultSelector, IEqualityComparer comparer) => GroupJoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); public static IAsyncEnumerable JoinAwait(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector) => JoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable JoinAwait(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector, IEqualityComparer comparer) => JoinAwaitCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); /// /// Returns the last element of an async-enumerable sequence that satisfies the condition in the predicate. /// /// The type of the elements in the source sequence. /// Source async-enumerable sequence. /// An asynchronous predicate function to evaluate for elements in the source sequence. /// The optional cancellation token to be used for cancelling the sequence at any time. /// ValueTask containing the last element in the async-enumerable sequence that satisfies the condition in the predicate. /// or is null. /// (Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty. public static ValueTask LastAwaitAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastAwaitAsyncCore(source, predicate, cancellationToken); /// /// Returns the last element of an async-enumerable sequence that satisfies the condition in the predicate, or a default value if no such element exists. /// /// The type of the elements in the source sequence. /// Source async-enumerable sequence. /// An asynchronous predicate function to evaluate for elements in the source sequence. /// The optional cancellation token to be used for cancelling the sequence at any time. /// ValueTask containing the last element in the async-enumerable sequence that satisfies the condition in the predicate, or a default value if no such element exists. /// or is null. public static ValueTask LastOrDefaultAwaitAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastOrDefaultAwaitAsyncCore(source, predicate, cancellationToken); /// /// Returns an async-enumerable sequence containing a that represents the number of elements in the specified async-enumerable sequence that satisfy a condition. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence that contains elements to be counted. /// An asynchronous predicate to test each element for a condition. /// The optional cancellation token to be used for cancelling the sequence at any time. /// An async-enumerable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask LongCountAwaitAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LongCountAwaitAsyncCore(source, predicate, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the maximum value. /// /// The type of the elements in the source sequence. /// The type of the objects derived from the elements in the source sequence to determine the maximum of. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a single element with the value that corresponds to the maximum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Returns the maximum value in an async-enumerable sequence. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Returns the maximum value in an async-enumerable sequence. /// /// Type of elements in the source sequence. /// The source sequence. /// An asynchronous transform function to invoke and await on each element of the source. /// The optional cancellation token to be usef for cancelling the sequence at any time. /// A ValueTask containing the maximum value in the sequence. /// or is . public static ValueTask MaxAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Invokes and awaits a transform function on each element of a sequence and returns the minimum value. /// /// The type of the elements in the source sequence. /// The type of the objects derived from the elements in the source sequence to determine the minimum of. /// An async-enumerable sequence to determine the minimum element of. /// An asynchronous transform function to invoke and await on each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask sequence containing a single element with the value that corresponds to the minimum element in the source sequence. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask MinAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitAsyncCore(source, selector, cancellationToken); /// /// Sorts the elements of a sequence in ascending order according to a key obtained by invoking a transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An async-enumerable sequence of values to order. /// An asynchronous function to extract a key from an element. /// An ordered async-enumerable sequence whose elements are sorted according to a key. /// or is null. public static IOrderedAsyncEnumerable OrderByAwait(this IAsyncEnumerable source, Func> keySelector) => OrderByAwaitCore(source, keySelector); /// /// Sorts the elements of a sequence in ascending order by using a specified comparer. The keys are obtained by invoking the transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An async-enumerable sequence of values to order. /// An asynchronous function to extract a key from an element. /// A comparer to compare keys. /// An ordered async-enumerable sequence whose elements are sorted according to a key. /// or is null. public static IOrderedAsyncEnumerable OrderByAwait(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByAwaitCore(source, keySelector, comparer); /// /// Sorts the elements of a sequence in descending order according to a key obtained by invoking a transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An async-enumerable sequence of values to order. /// An asynchronous function to extract a key from an element. /// An ordered async-enumerable sequence whose elements are sorted in descending order according to a key. /// or is null. public static IOrderedAsyncEnumerable OrderByDescendingAwait(this IAsyncEnumerable source, Func> keySelector) => OrderByDescendingAwaitCore(source, keySelector); /// /// Sorts the elements of a sequence in descending order by using a specified comparer. The keys are obtained by invoking the transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An async-enumerable sequence of values to order. /// An asynchronous function to extract a key from an element. /// A comparer to compare keys. /// An ordered async-enumerable sequence whose elements are sorted in descending order according to a key. /// or is null. public static IOrderedAsyncEnumerable OrderByDescendingAwait(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByDescendingAwaitCore(source, keySelector, comparer); /// /// Projects each element of an async-enumerable sequence into a new form by applying an asynchronous selector function to each member of the source sequence and awaiting the result. /// /// The type of the elements in the source sequence. /// The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence and awaiting the result. /// A sequence of elements to invoke a transform function on. /// An asynchronous transform function to apply to each source element. /// An async-enumerable sequence whose elements are the result of invoking the transform function on each element of the source sequence and awaiting the result. /// or is null. public static IAsyncEnumerable SelectAwait(this IAsyncEnumerable source, Func> selector) => SelectAwaitCore(source, selector); /// /// Projects each element of an async-enumerable sequence into a new form by applying an asynchronous selector function that incorporates each element's index to each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// The type of elements in the result sequence, obtained by running the selector function for each element and its index, and awaiting the result. /// A sequence of elements to invoke a transform function on. /// An asynchronous transform function to apply to each source element; the second parameter represents the index of the element. /// An async-enumerable sequence whose elements are the result of invoking the transform function on each element and its index of the source sequence and awaiting the result. /// or is null. public static IAsyncEnumerable SelectAwait(this IAsyncEnumerable source, Func> selector) => SelectAwaitCore(source, selector); /// /// Projects each element of an async-enumerable sequence into an async-enumerable sequence and merges the resulting async-enumerable sequences into one async-enumerable sequence. /// /// The type of elements in the source sequence. /// The type of elements in the projected inner sequences and the merged result sequence. /// An async-enumerable sequence of elements to project. /// An asynchronous selector function to apply to each element of the source sequence. /// An async-enumerable sequence whose elements are the result of invoking the one-to-many transform function on each element of the source sequence and awaiting the result. /// or is null. public static IAsyncEnumerable SelectManyAwait(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitCore(source, selector); /// /// Projects each element of an async-enumerable sequence into an async-enumerable sequence by incorporating the element's index and merges the resulting async-enumerable sequences into an async-enumerable sequence. /// /// The type of elements in the source sequence. /// The type of elements in the projected inner sequences and the merged result sequence. /// An async-enumerable sequence of elements to project. /// An asynchronous selector function to apply to each element; the second parameter represents the index of the element. /// An async-enumerable sequence who's elements are the result of invoking the one-to-many transform function on each element of the source sequence and awaiting the result. /// or is null. public static IAsyncEnumerable SelectManyAwait(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitCore(source, selector); /// /// Projects each element of an async-enumerable sequence to an async-enumerable sequence by awaiting the result of a transform function, invokes the result selector for each of the source elements and each of the corrasponding inner-sequence's elements and awaits the result, and merges the results into one async-enumerable sequence. /// /// The type of elements in the source sequence. /// The type of elements in the projected intermediate sequences. /// The type of elements in the result sequence. /// An async-enumerable sequence of elements to project. /// An asynchronous transform function to apply to each source element. /// An asynchronous transform function to apply to each element of the intermediate sequence. /// An async-enumerable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence, awaiting the result, applying to each element of the intermediate sequences along with their corrasponding source element and awaiting the result. /// , , or is . public static IAsyncEnumerable SelectManyAwait(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitCore(source, collectionSelector, resultSelector); /// /// Projects each element of an async-enumerable sequence to an async-enumerable sequence by awaiting the result of a transform function that incorporates each element's index, /// invokes the result selector for the source element and each of the corrasponding inner-sequence's elements and awaits the result, and merges the results into one async-enumerable sequence. /// /// The type of elements in the source sequence. /// The type of elements in the projected intermediate sequences. /// The type of elements in the result sequence. /// An async-enumerable sequence of elements to project. /// An asynchronous transform function to apply to each source element; the second parameter represents the index of the element. /// An asynchronous transform function to apply to each element of the intermediate sequence. /// An async-enumerable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence, awaiting the result, applying to each element of the intermediate sequences olong with their corrasponding source element and awaiting the result. /// , , or is . public static IAsyncEnumerable SelectManyAwait(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitCore(source, collectionSelector, resultSelector); /// /// Returns the only element of an async-enumerable sequence that satisfies the condition in the asynchronous predicate, and reports an exception if there is not exactly one element in the async-enumerable sequence that matches the predicate. /// /// The type of elements in the source sequence. /// Source async-enumerable sequence. /// An asynchronous predicate that will be applied to each element of the source sequence. /// The optional cancellation token to be used for cancelling the sequence at any time. /// ValueTask containing the only element in the async-enumerable sequence that satisfies the condition in the asynchronous predicate. /// or is null. /// (Asynchronous) No element satisfies the condition in the predicate. -or- More than one element satisfies the condition in the predicate. -or- The source sequence is empty. public static ValueTask SingleAwaitAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleAwaitAsyncCore(source, predicate, cancellationToken); /// /// Returns the only element of an async-enumerable sequence that satisfies the condition in the asynchronous predicate, or a default value if no such element exists, and reports an exception if there is more than one element in the async-enumerable sequence that matches the predicate. /// /// The type of elements in the source sequence. /// Source async-enumerable sequence. /// An asynchronous predicate that will be applied to each element of the source sequence. /// The optional cancellation token to be used for cancelling the sequence at any time. /// ValueTask containing the only element in the async-enumerable sequence that satisfies the condition in the asynchronous predicate, or a default value if no such element exists. /// or is null. /// (Asynchronous) More than one element satisfies the condition in the predicate. public static ValueTask SingleOrDefaultAwaitAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleOrDefaultAwaitAsyncCore(source, predicate, cancellationToken); /// /// Bypasses elements in an async-enumerable sequence as long as a condition is true, and then returns the remaining elements. /// /// The type of elements in the source sequence. /// An async-enumerable sequence to return elements from. /// An asynchronous function to test each element for a condition. /// An async-enumerable sequence containing the elements in the source sequence starting at the first element that does not pass the test specified by the predicate. /// or is . public static IAsyncEnumerable SkipWhileAwait(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitCore(source, predicate); /// /// Bypasses elements in an async-enumerable sequence as long as a condition is true, and then returns the remaining elements. /// The index of the element is used by the predicate. /// /// The type of elements in the source sequence. /// An async-enumerable sequence to return elements from. /// An asynchronous function to test each element for a condition; the second parameter of the function represents the index of the element. /// An async-enumerable sequence containing the elements in the source sequence starting at the first element that does not pass the test specified by the predicate. /// or is . public static IAsyncEnumerable SkipWhileAwait(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitCore(source, predicate); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Computes the sum of a sequence of values that are obtained by invoking a transform function on each element of the source sequence and awaiting the result. /// /// The type of elements in the source sequence. /// A sequence of values that are used to calculate a sum. /// An asynchronous transform function to apply to each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing the sum of the values in the source sequence. /// or is . /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask SumAwaitAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitAsyncCore(source, selector, cancellationToken); /// /// Returns elements from an async-enumerable sequence as long as a specified condition is true. /// /// The type of the elements in the source sequence. /// A sequence to return elements from. /// An asynchronous predicate to test each element for a condition. /// An async-enumerable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. /// or is null. public static IAsyncEnumerable TakeWhileAwait(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitCore(source, predicate); /// /// Returns elements from an async-enumerable sequence as long as a specified condition is true. /// The element's index is used in the logic of the predicate function. /// /// The type of the elements in the source sequence. /// A sequence to return elements from. /// An asynchronous function to test each element for a condition; the second parameter of the function represents the index of the source element. /// An async-enumerable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. /// or is null. public static IAsyncEnumerable TakeWhileAwait(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitCore(source, predicate); /// /// Performs a subsequent ordering of the elements in a sequence in ascending order according to a key obtained by invoking a transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An ordered async-enumerable sequence that contains elements to sort. /// An asynchronous function to extract a key from each element. /// An ordered async-enumerable whose elements are sorted according to a key. /// or is null. public static IOrderedAsyncEnumerable ThenByAwait(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByAwaitCore(source, keySelector); /// /// Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer. The keys are obtained by invoking a transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An ordered async-enumerable sequence that contains elements to sort. /// An asynchronous function to extract a key from each element. /// A comparer to compare keys. /// An ordered async-enumerable whose elements are sorted according to a key. /// or is null. public static IOrderedAsyncEnumerable ThenByAwait(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByAwaitCore(source, keySelector, comparer); /// /// Performs a subsequent ordering of the elements in a sequence in descending order, according to a key obtained by invoking a transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An ordered async-enumerable sequence that contains elements to sort. /// An asynchronous function to extract a key from each element. /// An ordered async-enumerable sequence whose elements are sorted in descending order according to a key. /// or is null. public static IOrderedAsyncEnumerable ThenByDescendingAwait(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByDescendingAwaitCore(source, keySelector); /// /// Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer. The keys are obtained by invoking a transform function on each element and awaiting the result. /// /// The type of the elements of source. /// The type of the key returned by keySelector. /// An ordered async-enumerable sequence that contains elements to sort. /// An asynchronous function to extract a key from each element. /// A comparer to compare keys. /// An ordered async-enumerable sequence whose elements are sorted in descending order according to a key. /// or is null. public static IOrderedAsyncEnumerable ThenByDescendingAwait(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByDescendingAwaitCore(source, keySelector, comparer); /// /// Creates a dictionary from an async-enumerable sequence by invoking a key-selector function on each element and awaiting the result. /// /// The type of the elements in the source sequence. /// The type of the dictionary key computed for each element in the source sequence. /// An async-enumerable sequence to create a dictionary for. /// An asynchronous function to extract a key from each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a dictionary mapping unique key values onto the corresponding source sequence's element. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToDictionaryAwaitAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, cancellationToken); /// /// Creates a dictionary from an async-enumerable sequence by invoking a key-selector function on each element and awaiting the result. /// /// The type of the elements in the source sequence. /// The type of the dictionary key computed for each element in the source sequence. /// An async-enumerable sequence to create a dictionary for. /// An asynchronous function to extract a key from each element. /// An equality comparer to compare keys. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a dictionary mapping unique key values onto the corresponding source sequence's element. /// or or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToDictionaryAwaitAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, comparer, cancellationToken); /// /// Creates a dictionary from an async-enumerable sequence using the specified asynchronous key and element selector functions. /// /// The type of the elements in the source sequence. /// The type of the dictionary key computed for each element in the source sequence. /// The type of the dictionary value computed for each element in the source sequence. /// An async-enumerable sequence to create a dictionary for. /// An asynchronous function to extract a key from each element. /// An asynchronous transform function to produce a result element value from each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a dictionary mapping unique key values onto the corresponding source sequence's element. /// or or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToDictionaryAwaitAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, elementSelector, cancellationToken); /// /// Creates a dictionary from an async-enumerable sequence using the specified asynchronous key and element selector functions. /// /// The type of the elements in the source sequence. /// The type of the dictionary key computed for each element in the source sequence. /// The type of the dictionary value computed for each element in the source sequence. /// An async-enumerable sequence to create a dictionary for. /// An asynchronous function to extract a key from each element. /// An asynchronous transform function to produce a result element value from each element. /// An equality comparer to compare keys. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a dictionary mapping unique key values onto the corresponding source sequence's element. /// or or or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToDictionaryAwaitAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); /// /// Creates a lookup from an async-enumerable sequence by invoking a key-selector function on each element and awaiting the result. /// /// The type of the elements in the source sequence. /// The type of the lookup key computed for each element in the source sequence. /// An async-enumerable sequence to create a lookup for. /// An asynchronous function to extract a key from each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a lookup mapping unique key values onto the corresponding source sequence's elements. /// or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToLookupAwaitAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, cancellationToken); /// /// Creates a lookup from an async-enumerable sequence by invoking key and element selector functions on each source element and awaiting the results. /// /// The type of the elements in the source sequence. /// The type of the lookup key computed for each element in the source sequence. /// The type of the lookup value computed for each element in the source sequence. /// An async-enumerable sequence to create a lookup for. /// An asynchronous function to extract a key from each element. /// An asynchronous transform function to produce a result element value from each element. /// The optional cancellation token to be used for cancelling the sequence at any time. /// An async-enumerable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements. /// or or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToLookupAwaitAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, elementSelector, cancellationToken); /// /// Creates a lookup from an async-enumerable sequence by invoking a key-selector function on each element and awaiting the result. /// /// The type of the elements in the source sequence. /// The type of the lookup key computed for each element in the source sequence. /// An async-enumerable sequence to create a lookup for. /// An asynchronous function to extract a key from each element. /// An equality comparer to compare keys. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a lookup mapping unique key values onto the corresponding source sequence's elements. /// or or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToLookupAwaitAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, comparer, cancellationToken); /// /// Creates a lookup from an async-enumerable sequence by invoking key and element selector functions on each source element and awaiting the results. /// /// The type of the elements in the source sequence. /// The type of the lookup key computed for each element in the source sequence. /// The type of the lookup value computed for each element in the source sequence. /// An async-enumerable sequence to create a lookup for. /// An asynchronous function to extract a key from each element. /// An asynchronous transform function to produce a result element value from each source element. /// An equality comparer to compare keys. /// The optional cancellation token to be used for cancelling the sequence at any time. /// A ValueTask containing a lookup mapping unique key values onto the corresponding source sequence's elements. /// or or or is null. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. public static ValueTask> ToLookupAwaitAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); /// /// Filters the elements of an async-enumerable sequence based on an asynchronous predicate. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence whose elements to filter. /// An asynchronous predicate to test each source element for a condition. /// An async-enumerable sequence that contains elements from the input sequence that satisfy the condition. /// or is null. public static IAsyncEnumerable WhereAwait(this IAsyncEnumerable source, Func> predicate) => WhereAwaitCore(source, predicate); /// /// Filters the elements of an async-enumerable sequence based on an asynchronous predicate that incorporates the element's index. /// /// The type of the elements in the source sequence. /// An async-enumerable sequence whose elements to filter. /// An asynchronous predicate to test each source element for a condition; the second parameter of the function represents the index of the source element. /// An async-enumerable sequence that contains elements from the input sequence that satisfy the condition. /// or is null. public static IAsyncEnumerable WhereAwait(this IAsyncEnumerable source, Func> predicate) => WhereAwaitCore(source, predicate); /// /// Merges two async-enumerable sequences into one async-enumerable sequence by combining their elements in a pairwise fashion. /// /// The type of the elements in the first source sequence. /// The type of the elements in the second source sequence. /// The type of the elements in the result sequence, returned by the selector function. /// First async-enumerable source. /// Second async-enumerable source. /// An asynchronous function to invoke and await for each consecutive pair of elements from the first and second source. /// An async-enumerable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function. /// or or is null. public static IAsyncEnumerable ZipAwait(this IAsyncEnumerable first, IAsyncEnumerable second, Func> selector) => ZipAwaitCore(first, second, selector); #if !NO_DEEP_CANCELLATION public static ValueTask FirstAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask FirstOrDefaultAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => FirstOrDefaultAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static Task ForEachAwaitWithCancellationAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken) => ForEachAwaitWithCancellationAsyncCore(source, action, cancellationToken); public static Task ForEachAwaitWithCancellationAsync(this IAsyncEnumerable source, Func action, CancellationToken cancellationToken) => ForEachAwaitWithCancellationAsyncCore(source, action, cancellationToken); public static IAsyncEnumerable> GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector) => GroupByAwaitWithCancellationCore(source, keySelector); public static IAsyncEnumerable> GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, comparer); public static IAsyncEnumerable> GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector); public static IAsyncEnumerable GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, Func, CancellationToken, ValueTask> resultSelector) => GroupByAwaitWithCancellationCore(source, keySelector, resultSelector); public static IAsyncEnumerable GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, CancellationToken, ValueTask> resultSelector) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector, resultSelector); public static IAsyncEnumerable> GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector, comparer); public static IAsyncEnumerable GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, Func, CancellationToken, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, resultSelector, comparer); public static IAsyncEnumerable GroupByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, Func, CancellationToken, ValueTask> resultSelector, IEqualityComparer comparer) => GroupByAwaitWithCancellationCore(source, keySelector, elementSelector, resultSelector, comparer); public static IAsyncEnumerable GroupJoinAwaitWithCancellation(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, CancellationToken, ValueTask> resultSelector) => GroupJoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable GroupJoinAwaitWithCancellation(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func, CancellationToken, ValueTask> resultSelector, IEqualityComparer comparer) => GroupJoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); public static IAsyncEnumerable JoinAwaitWithCancellation(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector) => JoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector); public static IAsyncEnumerable JoinAwaitWithCancellation(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func> outerKeySelector, Func> innerKeySelector, Func> resultSelector, IEqualityComparer comparer) => JoinAwaitWithCancellationCore(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer); public static ValueTask LastAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask LastOrDefaultAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LastOrDefaultAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask LongCountAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => LongCountAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MaxAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask MinAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => MinAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static IOrderedAsyncEnumerable OrderByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector) => OrderByAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable OrderByAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByAwaitWithCancellationCore(source, keySelector, comparer); public static IOrderedAsyncEnumerable OrderByDescendingAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector) => OrderByDescendingAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable OrderByDescendingAwaitWithCancellation(this IAsyncEnumerable source, Func> keySelector, IComparer comparer) => OrderByDescendingAwaitWithCancellationCore(source, keySelector, comparer); public static IAsyncEnumerable SelectAwaitWithCancellation(this IAsyncEnumerable source, Func> selector) => SelectAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable SelectAwaitWithCancellation(this IAsyncEnumerable source, Func> selector) => SelectAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable SelectManyAwaitWithCancellation(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable SelectManyAwaitWithCancellation(this IAsyncEnumerable source, Func>> selector) => SelectManyAwaitWithCancellationCore(source, selector); public static IAsyncEnumerable SelectManyAwaitWithCancellation(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitWithCancellationCore(source, collectionSelector, resultSelector); public static IAsyncEnumerable SelectManyAwaitWithCancellation(this IAsyncEnumerable source, Func>> collectionSelector, Func> resultSelector) => SelectManyAwaitWithCancellationCore(source, collectionSelector, resultSelector); public static ValueTask SingleAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static ValueTask SingleOrDefaultAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) => SingleOrDefaultAwaitWithCancellationAsyncCore(source, predicate, cancellationToken); public static IAsyncEnumerable SkipWhileAwaitWithCancellation(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable SkipWhileAwaitWithCancellation(this IAsyncEnumerable source, Func> predicate) => SkipWhileAwaitWithCancellationCore(source, predicate); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static ValueTask SumAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) => SumAwaitWithCancellationAsyncCore(source, selector, cancellationToken); public static IAsyncEnumerable TakeWhileAwaitWithCancellation(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable TakeWhileAwaitWithCancellation(this IAsyncEnumerable source, Func> predicate) => TakeWhileAwaitWithCancellationCore(source, predicate); public static IOrderedAsyncEnumerable ThenByAwaitWithCancellation(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable ThenByAwaitWithCancellation(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByAwaitWithCancellationCore(source, keySelector, comparer); public static IOrderedAsyncEnumerable ThenByDescendingAwaitWithCancellation(this IOrderedAsyncEnumerable source, Func> keySelector) => ThenByDescendingAwaitWithCancellationCore(source, keySelector); public static IOrderedAsyncEnumerable ThenByDescendingAwaitWithCancellation(this IOrderedAsyncEnumerable source, Func> keySelector, IComparer comparer) => ThenByDescendingAwaitWithCancellationCore(source, keySelector, comparer); public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, cancellationToken); public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, comparer, cancellationToken); public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, cancellationToken); public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) where TKey : notnull => ToDictionaryAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, cancellationToken); public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, cancellationToken); public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, comparer, cancellationToken); public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncEnumerable source, Func> keySelector, Func> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) => ToLookupAwaitWithCancellationAsyncCore(source, keySelector, elementSelector, comparer, cancellationToken); public static IAsyncEnumerable WhereAwaitWithCancellation(this IAsyncEnumerable source, Func> predicate) => WhereAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable WhereAwaitWithCancellation(this IAsyncEnumerable source, Func> predicate) => WhereAwaitWithCancellationCore(source, predicate); public static IAsyncEnumerable ZipAwaitWithCancellation(this IAsyncEnumerable first, IAsyncEnumerable second, Func> selector) => ZipAwaitWithCancellationCore(first, second, selector); #endif #endif } }