Ver Fonte

Reordering Aggregate overloads.

Bart De Smet há 8 anos atrás
pai
commit
f2600ee3ba
1 ficheiros alterados com 16 adições e 16 exclusões
  1. 16 16
      Ix.NET/Source/System.Interactive.Async/Aggregate.cs

+ 16 - 16
Ix.NET/Source/System.Interactive.Async/Aggregate.cs

@@ -10,68 +10,68 @@ namespace System.Linq
 {
     public static partial class AsyncEnumerable
     {
-        public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector)
+        public static Task<TSource> Aggregate<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator)
         {
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
                 throw new ArgumentNullException(nameof(accumulator));
-            if (resultSelector == null)
-                throw new ArgumentNullException(nameof(resultSelector));
 
-            return Aggregate(source, seed, accumulator, resultSelector, CancellationToken.None);
+            return Aggregate(source, accumulator, CancellationToken.None);
         }
 
-        public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
+        public static Task<TSource> Aggregate<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator, CancellationToken cancellationToken)
         {
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
                 throw new ArgumentNullException(nameof(accumulator));
 
-            return Aggregate(source, seed, accumulator, CancellationToken.None);
+            return Aggregate_(source, accumulator, cancellationToken);
         }
 
-        public static Task<TSource> Aggregate<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator)
+        public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
         {
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
                 throw new ArgumentNullException(nameof(accumulator));
 
-            return Aggregate(source, accumulator, CancellationToken.None);
+            return Aggregate(source, seed, accumulator, CancellationToken.None);
         }
 
-        public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken)
+        public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, CancellationToken cancellationToken)
         {
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
                 throw new ArgumentNullException(nameof(accumulator));
-            if (resultSelector == null)
-                throw new ArgumentNullException(nameof(resultSelector));
 
-            return Aggregate_(source, seed, accumulator, resultSelector, cancellationToken);
+            return source.Aggregate(seed, accumulator, x => x, cancellationToken);
         }
 
-        public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, CancellationToken cancellationToken)
+        public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector)
         {
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
                 throw new ArgumentNullException(nameof(accumulator));
+            if (resultSelector == null)
+                throw new ArgumentNullException(nameof(resultSelector));
 
-            return source.Aggregate(seed, accumulator, x => x, cancellationToken);
+            return Aggregate(source, seed, accumulator, resultSelector, CancellationToken.None);
         }
 
-        public static Task<TSource> Aggregate<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator, CancellationToken cancellationToken)
+        public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken)
         {
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
             if (accumulator == null)
                 throw new ArgumentNullException(nameof(accumulator));
+            if (resultSelector == null)
+                throw new ArgumentNullException(nameof(resultSelector));
 
-            return Aggregate_(source, accumulator, cancellationToken);
+            return Aggregate_(source, seed, accumulator, resultSelector, cancellationToken);
         }
 
         private static async Task<TResult> Aggregate_<TSource, TAccumulate, TResult>(IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken)