diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.cs index c222c8c5..c496836f 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncEnumerable.AsyncOverloads.cs @@ -11,7 +11,6 @@ namespace System.Linq partial class AsyncEnumerable { #if SUPPORT_FLAT_ASYNC_API - 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); @@ -94,7 +93,6 @@ namespace System.Linq public static IAsyncEnumerable Zip(this IAsyncEnumerable first, IAsyncEnumerable second, Func> selector) => ZipAwaitCore(first, second, selector); #if !NO_DEEP_CANCELLATION - 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); @@ -177,17 +175,6 @@ namespace System.Linq 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, 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. /// @@ -1112,7 +1099,6 @@ namespace System.Linq public static IAsyncEnumerable ZipAwait(this IAsyncEnumerable first, IAsyncEnumerable second, Func> selector) => ZipAwaitCore(first, second, selector); #if !NO_DEEP_CANCELLATION - 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); diff --git a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/FirstOrDefault.cs b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/FirstOrDefault.cs index 11b7d720..d67b50ad 100644 --- a/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/FirstOrDefault.cs +++ b/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/FirstOrDefault.cs @@ -59,7 +59,17 @@ namespace System.Linq } } - internal static ValueTask FirstOrDefaultAwaitAsyncCore(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) + /// + /// 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 . + [GenerateAsyncOverload] + private static ValueTask FirstOrDefaultAwaitAsyncCore(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -77,7 +87,8 @@ namespace System.Linq } #if !NO_DEEP_CANCELLATION - internal static ValueTask FirstOrDefaultAwaitWithCancellationAsyncCore(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) + [GenerateAsyncOverload] + private static ValueTask FirstOrDefaultAwaitWithCancellationAsyncCore(this IAsyncEnumerable source, Func> predicate, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source));