Add Ix.NET AverageAsync overloads supporting async selectors #2278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
System.Linq.Asyncalways offered versions of theAverageAsyncoperator that accepted projection selectors. These came in three forms:Func<TSource, TResult>-style selectorsFunc<TSource, ValueTask<TResult>>Func<TSource, CancellationToken, ValueTask<TResult>>System.Linq.Asyncis being deprecated because the .NET class libraries now include most of theIAsyncEnumerable<T>LINQ functionality inSystem.Linq.AsyncEnumerable. However, certain features are missing in that, include projection-based averaging.In cases where
System.Linq.AsyncEnumerabledoes not offer equivalent functionality, we're moving features out ofSystem.Linq.Asyncand intoSystem.Interactive.Async.However, we missed 2 and 3 here. That happened because those overload have different names:
AverageAwaitAsync, andAverageAwaitWithCancellationAsync.) Those naming conventions are out of line with .NET guidelines, so as part of this migration we've been deprecating anything using those old conventions. In many cases, .NET'sSystem.Linq.AsyncEnumerable, adds new methods with the same functionality but with proper naming conventions. In cases where .NET has not replicated our functionality, we have followed suit by deprecating these methods and then defining properly-named overloads inSystem.Interactive.Async.Except that in this case we only did the deprecation part: we forgot to add the equivalent properly named overloads in
System.Interactive.Async. This fixes that.