diff --git a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Average.Generated.cs b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Average.Generated.cs index cb32b46397..b477345a94 100644 --- a/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Average.Generated.cs +++ b/Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Average.Generated.cs @@ -56,9 +56,893 @@ static async ValueTask Core(IAsyncEnumerable source, Func + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + long sum = await selector(e.Current).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current).ConfigureAwait(false); + ++count; + } + } + + return (double)sum / count; + } + } + } + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + long sum = await selector(e.Current, cancellationToken).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current, cancellationToken).ConfigureAwait(false); + ++count; + } + } + + return (double)sum / count; + } + } + } + + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// + /// The type of the elements in the source sequence. + /// A sequence of values to calculate the average of. + /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. + /// or is null. + /// (Asynchronous) The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + long sum = selector(e.Current); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += selector(e.Current); + ++count; + } + } + + return (double)sum / count; + } + } + } + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + long sum = await selector(e.Current).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current).ConfigureAwait(false); + ++count; + } + } + + return (double)sum / count; + } + } + } + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + long sum = await selector(e.Current, cancellationToken).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current, cancellationToken).ConfigureAwait(false); + ++count; + } + } + + return (double)sum / count; + } + } + } + + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// + /// The type of the elements in the source sequence. + /// A sequence of values to calculate the average of. + /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. + /// or is null. + /// (Asynchronous) The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + double sum = selector(e.Current); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += selector(e.Current); + ++count; + } + } + + return (float)(sum / count); + } + } + } + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + double sum = await selector(e.Current).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current).ConfigureAwait(false); + ++count; + } + } + + return (float)(sum / count); + } + } + } + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + double sum = await selector(e.Current, cancellationToken).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current, cancellationToken).ConfigureAwait(false); + ++count; + } + } + + return (float)(sum / count); + } + } + } + + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// + /// The type of the elements in the source sequence. + /// A sequence of values to calculate the average of. + /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. + /// or is null. + /// (Asynchronous) The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + double sum = selector(e.Current); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += selector(e.Current); + ++count; + } + } + + return sum / count; + } + } + } + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + double sum = await selector(e.Current).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current).ConfigureAwait(false); + ++count; + } + } + + return sum / count; + } + } + } + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + double sum = await selector(e.Current, cancellationToken).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current, cancellationToken).ConfigureAwait(false); + ++count; + } + } + + return sum / count; + } + } + } + + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// + /// The type of the elements in the source sequence. + /// A sequence of values to calculate the average of. + /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. + /// or is null. + /// (Asynchronous) The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + decimal sum = selector(e.Current); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += selector(e.Current); + ++count; + } + } + + return sum / count; + } + } + } + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + decimal sum = await selector(e.Current).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current).ConfigureAwait(false); + ++count; + } + } + + return sum / count; + } + } + } + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + decimal sum = await selector(e.Current, cancellationToken).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current, cancellationToken).ConfigureAwait(false); + ++count; + } + } + + return sum / count; + } + } + } + + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// + /// The type of the elements in the source sequence. + /// A sequence of values to calculate the average of. + /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. + /// or is null. + /// (Asynchronous) The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = selector(e.Current); + if (v.HasValue) + { + long sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = selector(e.Current); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (double)sum / count; + } + } + } + + return null; + } + } + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) + { + long sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (double)sum / count; + } + } + } + + return null; + } + } + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) + { + long sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (double)sum / count; + } + } + } + + return null; + } + } + + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// + /// The type of the elements in the source sequence. + /// A sequence of values to calculate the average of. + /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. + /// or is null. + /// (Asynchronous) The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = selector(e.Current); + if (v.HasValue) + { + long sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = selector(e.Current); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (double)sum / count; + } + } + } + + return null; + } + } + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) + { + long sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (double)sum / count; + } + } + } + + return null; + } + } + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) + { + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) + { + long sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (double)sum / count; + } + } + } + + return null; + } + } + /// - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements in the source sequence. /// A sequence of values to calculate the average of. @@ -68,7 +952,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func or is null. /// (Asynchronous) The source sequence is empty. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -77,44 +961,52 @@ public static ValueTask AverageAsync(this IAsyncEnumerable Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { - if (!await e.MoveNextAsync()) - { - throw Error.NoElements(); - } - - long sum = selector(e.Current); - long count = 1; - checked + while (await e.MoveNextAsync()) { - while (await e.MoveNextAsync()) + var v = selector(e.Current); + if (v.HasValue) { - sum += selector(e.Current); - ++count; + double sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = selector(e.Current); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (float)(sum / count); } } - - return (double)sum / count; } + + return null; } } - /// - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. /// - /// The type of the elements in the source sequence. - /// A sequence of values to calculate the average of. - /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. - /// or is null. - /// (Asynchronous) The source sequence is empty. + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -123,44 +1015,40 @@ public static ValueTask AverageAsync(this IAsyncEnumerable Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { - if (!await e.MoveNextAsync()) - { - throw Error.NoElements(); - } - - double sum = selector(e.Current); - long count = 1; - checked + while (await e.MoveNextAsync()) { - while (await e.MoveNextAsync()) + var v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) { - sum += selector(e.Current); - ++count; + double sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (float)(sum / count); } } - - return (float)(sum / count); } + + return null; } } - - - /// - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. - /// - /// The type of the elements in the source sequence. - /// A sequence of values to calculate the average of. - /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. - /// or is null. - /// (Asynchronous) The source sequence is empty. - /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -169,34 +1057,42 @@ public static ValueTask AverageAsync(this IAsyncEnumerable Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { - if (!await e.MoveNextAsync()) - { - throw Error.NoElements(); - } - - double sum = selector(e.Current); - long count = 1; - checked + while (await e.MoveNextAsync()) { - while (await e.MoveNextAsync()) + var v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) { - sum += selector(e.Current); - ++count; + double sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return (float)(sum / count); } } - - return sum / count; } + + return null; } } /// - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements in the source sequence. /// A sequence of values to calculate the average of. @@ -206,7 +1102,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func or is null. /// (Asynchronous) The source sequence is empty. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -215,44 +1111,52 @@ public static ValueTask AverageAsync(this IAsyncEnumerable Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { - if (!await e.MoveNextAsync()) - { - throw Error.NoElements(); - } - - decimal sum = selector(e.Current); - long count = 1; - checked + while (await e.MoveNextAsync()) { - while (await e.MoveNextAsync()) + var v = selector(e.Current); + if (v.HasValue) { - sum += selector(e.Current); - ++count; + double sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = selector(e.Current); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return sum / count; } } - - return sum / count; } + + return null; } } - /// - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. /// - /// The type of the elements in the source sequence. - /// A sequence of values to calculate the average of. - /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. - /// or is null. - /// (Asynchronous) The source sequence is empty. + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -261,22 +1165,22 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { while (await e.MoveNextAsync()) { - var v = selector(e.Current); + var v = await selector(e.Current).ConfigureAwait(false); if (v.HasValue) { - long sum = v.GetValueOrDefault(); + double sum = v.GetValueOrDefault(); long count = 1; checked { while (await e.MoveNextAsync()) { - v = selector(e.Current); + v = await selector(e.Current).ConfigureAwait(false); if (v.HasValue) { sum += v.GetValueOrDefault(); @@ -285,7 +1189,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. - /// - /// The type of the elements in the source sequence. - /// A sequence of values to calculate the average of. - /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. - /// or is null. - /// (Asynchronous) The source sequence is empty. - /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -315,22 +1207,22 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { while (await e.MoveNextAsync()) { - var v = selector(e.Current); + var v = await selector(e.Current, cancellationToken).ConfigureAwait(false); if (v.HasValue) { - long sum = v.GetValueOrDefault(); + double sum = v.GetValueOrDefault(); long count = 1; checked { while (await e.MoveNextAsync()) { - v = selector(e.Current); + v = await selector(e.Current, cancellationToken).ConfigureAwait(false); if (v.HasValue) { sum += v.GetValueOrDefault(); @@ -339,7 +1231,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements in the source sequence. /// A sequence of values to calculate the average of. @@ -360,7 +1252,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func or is null. /// (Asynchronous) The source sequence is empty. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -369,7 +1261,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { @@ -378,7 +1270,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. /// - /// The type of the elements in the source sequence. - /// A sequence of values to calculate the average of. - /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. - /// or is null. - /// (Asynchronous) The source sequence is empty. + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -423,22 +1315,22 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { while (await e.MoveNextAsync()) { - var v = selector(e.Current); + var v = await selector(e.Current).ConfigureAwait(false); if (v.HasValue) { - double sum = v.GetValueOrDefault(); + decimal sum = v.GetValueOrDefault(); long count = 1; checked { while (await e.MoveNextAsync()) { - v = selector(e.Current); + v = await selector(e.Current).ConfigureAwait(false); if (v.HasValue) { sum += v.GetValueOrDefault(); @@ -455,20 +1347,8 @@ static async ValueTask Core(IAsyncEnumerable source, Func - /// Computes the average of an async-enumerable sequence of values that are obtained by invoking a transform function on each element of the input sequence. - /// - /// The type of the elements in the source sequence. - /// A sequence of values to calculate the average of. - /// A transform function to apply to 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 the average of the sequence of values, or null if the source sequence is empty or contains only values that are null. - /// or is null. - /// (Asynchronous) The source sequence is empty. - /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. - public static ValueTask AverageAsync(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken = default) + [GenerateAsyncOverload] + private static ValueTask AverageAsyncCore(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken = default) { if (source == null) throw Error.ArgumentNull(nameof(source)); @@ -477,13 +1357,13 @@ static async ValueTask Core(IAsyncEnumerable source, Func Core(IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + static async ValueTask Core(IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) { await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) { while (await e.MoveNextAsync()) { - var v = selector(e.Current); + var v = await selector(e.Current, cancellationToken).ConfigureAwait(false); if (v.HasValue) { decimal sum = v.GetValueOrDefault(); @@ -492,7 +1372,7 @@ static async ValueTask Core(IAsyncEnumerable source, Func + } + } + + /// + /// Computes the average of an async-enumerable sequence of values that are obtained by invoking an asynchronous transform function on each element of the source sequence and awaiting the result. + /// + /// The type of elements in the source sequence. + /// An async-enumerable sequence of values to compute the average of. + /// A transform function to invoke and await on each element of the source sequence. + /// An optional cancellation token for cancelling the sequence at any time. + /// A ValueTask containing the average of the sequence of values. + /// or is . + /// The source sequence is empty. + /// The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior. + [GenerateAsyncOverload] + private static ValueTask<<#=o.res#>> AverageAsyncCore(this IAsyncEnumerable source, Func>> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask<<#=o.res#>> Core(IAsyncEnumerable source, Func>> selector, CancellationToken cancellationToken) + { +<# +if (isNullable) +{ +#> + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) + { + <#=o.sum#> sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return <#=res#>; + } + } + } + + return null; +<# +} +else +{ +#> + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + <#=o.sum#> sum = await selector(e.Current).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current).ConfigureAwait(false); + ++count; + } + } + + return <#=res#>; + } +<# +} +#> + } + } + [GenerateAsyncOverload] + private static ValueTask<<#=o.res#>> AverageAsyncCore(this IAsyncEnumerable source, Func>> selector, CancellationToken cancellationToken = default) + { + if (source == null) + throw Error.ArgumentNull(nameof(source)); + if (selector == null) + throw Error.ArgumentNull(nameof(selector)); + + return Core(source, selector, cancellationToken); + + static async ValueTask<<#=o.res#>> Core(IAsyncEnumerable source, Func>> selector, CancellationToken cancellationToken) + { +<# +if (isNullable) +{ +#> + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + while (await e.MoveNextAsync()) + { + var v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) + { + <#=o.sum#> sum = v.GetValueOrDefault(); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + v = await selector(e.Current, cancellationToken).ConfigureAwait(false); + if (v.HasValue) + { + sum += v.GetValueOrDefault(); + ++count; + } + } + } + + return <#=res#>; + } + } + } + + return null; +<# +} +else +{ +#> + await using (var e = source.GetConfiguredAsyncEnumerator(cancellationToken, false)) + { + if (!await e.MoveNextAsync()) + { + throw Error.NoElements(); + } + + <#=o.sum#> sum = await selector(e.Current, cancellationToken).ConfigureAwait(false); + long count = 1; + checked + { + while (await e.MoveNextAsync()) + { + sum += await selector(e.Current, cancellationToken).ConfigureAwait(false); + ++count; + } + } + + return <#=res#>; + } +<# +} #> } } diff --git a/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Api/ApiApprovalTests.SystemInteractiveAsync.verified.cs b/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Api/ApiApprovalTests.SystemInteractiveAsync.verified.cs index 3a23fe3c10..e5c3ce6824 100644 --- a/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Api/ApiApprovalTests.SystemInteractiveAsync.verified.cs +++ b/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Api/ApiApprovalTests.SystemInteractiveAsync.verified.cs @@ -10,6 +10,16 @@ public static System.Collections.Generic.IAsyncEnumerable Amb( public static System.Collections.Generic.IAsyncEnumerable Amb(this System.Collections.Generic.IEnumerable> sources) { } public static System.Collections.Generic.IAsyncEnumerable Amb(this System.Collections.Generic.IAsyncEnumerable first, System.Collections.Generic.IAsyncEnumerable second) { } public static System.Collections.Generic.IAsyncEnumerable AsAsyncEnumerable(this System.Collections.Generic.IAsyncEnumerable source) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func selector, System.Threading.CancellationToken cancellationToken = default) { } public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func selector, System.Threading.CancellationToken cancellationToken = default) { } public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func selector, System.Threading.CancellationToken cancellationToken = default) { } @@ -20,6 +30,16 @@ public static System.Threading.Tasks.ValueTask AverageAsync(thi public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func selector, System.Threading.CancellationToken cancellationToken = default) { } public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func selector, System.Threading.CancellationToken cancellationToken = default) { } public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } + public static System.Threading.Tasks.ValueTask AverageAsync(this System.Collections.Generic.IAsyncEnumerable source, System.Func> selector, System.Threading.CancellationToken cancellationToken = default) { } public static System.Collections.Generic.IAsyncEnumerable> Buffer(this System.Collections.Generic.IAsyncEnumerable source, int count) { } public static System.Collections.Generic.IAsyncEnumerable> Buffer(this System.Collections.Generic.IAsyncEnumerable source, int count, int skip) { } public static System.Collections.Generic.IAsyncEnumerable Catch(params System.Collections.Generic.IAsyncEnumerable[] sources) { }