瀏覽代碼

Async variants of Average, Max, Min, and Sum.

Bart De Smet 8 年之前
父節點
當前提交
b7bc6a5a59

+ 200 - 0
Ix.NET/Source/System.Interactive.Async/Average.Generated.cs

@@ -46,6 +46,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<double> Average(this IAsyncEnumerable<long> source)
         {
             if (source == null)
@@ -82,6 +102,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<float> Average(this IAsyncEnumerable<float> source)
         {
             if (source == null)
@@ -118,6 +158,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<float> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<float> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<double> Average(this IAsyncEnumerable<double> source)
         {
             if (source == null)
@@ -154,6 +214,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<double> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<decimal> Average(this IAsyncEnumerable<decimal> source)
         {
             if (source == null)
@@ -190,6 +270,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<decimal> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<decimal> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<double?> Average(this IAsyncEnumerable<int?> source)
         {
             if (source == null)
@@ -226,6 +326,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<double?> Average(this IAsyncEnumerable<long?> source)
         {
             if (source == null)
@@ -262,6 +382,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<float?> Average(this IAsyncEnumerable<float?> source)
         {
             if (source == null)
@@ -298,6 +438,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<float?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<float?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<double?> Average(this IAsyncEnumerable<double?> source)
         {
             if (source == null)
@@ -334,6 +494,26 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<double?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
         public static Task<decimal?> Average(this IAsyncEnumerable<decimal?> source)
         {
             if (source == null)
@@ -370,5 +550,25 @@ namespace System.Linq
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<decimal?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<decimal?> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
     }
 }

+ 20 - 0
Ix.NET/Source/System.Interactive.Async/Average.Generated.tt

@@ -71,6 +71,26 @@ foreach (var o in os)
             return source.Select(selector).Average(cancellationToken);
         }
 
+        public static Task<<#=o.res#>> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<<#=o.type#>>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(CancellationToken.None);
+        }
+
+        public static Task<<#=o.res#>> Average<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<<#=o.type#>>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Average(cancellationToken);
+        }
+
 <#
 }
 #>

+ 400 - 0
Ix.NET/Source/System.Interactive.Async/MinMax.Generated.cs

@@ -46,6 +46,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<int> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<int> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<long> Max(this IAsyncEnumerable<long> source)
         {
             if (source == null)
@@ -82,6 +102,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<long> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<long> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<float> Max(this IAsyncEnumerable<float> source)
         {
             if (source == null)
@@ -118,6 +158,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<float> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<float> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<double> Max(this IAsyncEnumerable<double> source)
         {
             if (source == null)
@@ -154,6 +214,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<double> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<double> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<decimal> Max(this IAsyncEnumerable<decimal> source)
         {
             if (source == null)
@@ -190,6 +270,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<decimal> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<decimal> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<int?> Max(this IAsyncEnumerable<int?> source)
         {
             if (source == null)
@@ -226,6 +326,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<int?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<int?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<long?> Max(this IAsyncEnumerable<long?> source)
         {
             if (source == null)
@@ -262,6 +382,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<long?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<long?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<float?> Max(this IAsyncEnumerable<float?> source)
         {
             if (source == null)
@@ -298,6 +438,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<float?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<float?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<double?> Max(this IAsyncEnumerable<double?> source)
         {
             if (source == null)
@@ -334,6 +494,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<double?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<double?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<decimal?> Max(this IAsyncEnumerable<decimal?> source)
         {
             if (source == null)
@@ -370,6 +550,26 @@ namespace System.Linq
             return source.Select(selector).Max(cancellationToken);
         }
 
+        public static Task<decimal?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(CancellationToken.None);
+        }
+
+        public static Task<decimal?> Max<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Max(cancellationToken);
+        }
+
         public static Task<int> Min(this IAsyncEnumerable<int> source)
         {
             if (source == null)
@@ -406,6 +606,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<int> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<int> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<long> Min(this IAsyncEnumerable<long> source)
         {
             if (source == null)
@@ -442,6 +662,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<long> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<long> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<float> Min(this IAsyncEnumerable<float> source)
         {
             if (source == null)
@@ -478,6 +718,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<float> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<float> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<double> Min(this IAsyncEnumerable<double> source)
         {
             if (source == null)
@@ -514,6 +774,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<double> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<double> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<decimal> Min(this IAsyncEnumerable<decimal> source)
         {
             if (source == null)
@@ -550,6 +830,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<decimal> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<decimal> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<int?> Min(this IAsyncEnumerable<int?> source)
         {
             if (source == null)
@@ -586,6 +886,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<int?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<int?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<long?> Min(this IAsyncEnumerable<long?> source)
         {
             if (source == null)
@@ -622,6 +942,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<long?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<long?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<float?> Min(this IAsyncEnumerable<float?> source)
         {
             if (source == null)
@@ -658,6 +998,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<float?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<float?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<double?> Min(this IAsyncEnumerable<double?> source)
         {
             if (source == null)
@@ -694,6 +1054,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<double?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<double?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         public static Task<decimal?> Min(this IAsyncEnumerable<decimal?> source)
         {
             if (source == null)
@@ -730,6 +1110,26 @@ namespace System.Linq
             return source.Select(selector).Min(cancellationToken);
         }
 
+        public static Task<decimal?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(CancellationToken.None);
+        }
+
+        public static Task<decimal?> Min<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Min(cancellationToken);
+        }
+
         private static T? NullableMax<T>(T? x, T? y)
             where T : struct, IComparable<T>
         {

+ 20 - 0
Ix.NET/Source/System.Interactive.Async/MinMax.Generated.tt

@@ -99,6 +99,26 @@ else
             return source.Select(selector).<#=m#>(cancellationToken);
         }
 
+        public static Task<<#=t#>> <#=m#><TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<<#=t#>>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).<#=m#>(CancellationToken.None);
+        }
+
+        public static Task<<#=t#>> <#=m#><TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<<#=t#>>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).<#=m#>(cancellationToken);
+        }
+
 <#
     }
 }

+ 200 - 0
Ix.NET/Source/System.Interactive.Async/Sum.Generated.cs

@@ -46,6 +46,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<int> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<int> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<long> Sum(this IAsyncEnumerable<long> source)
         {
             if (source == null)
@@ -82,6 +102,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<long> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<long> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<float> Sum(this IAsyncEnumerable<float> source)
         {
             if (source == null)
@@ -118,6 +158,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<float> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<float> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<double> Sum(this IAsyncEnumerable<double> source)
         {
             if (source == null)
@@ -154,6 +214,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<double> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<double> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<decimal> Sum(this IAsyncEnumerable<decimal> source)
         {
             if (source == null)
@@ -190,6 +270,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<decimal> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<decimal> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<int?> Sum(this IAsyncEnumerable<int?> source)
         {
             if (source == null)
@@ -226,6 +326,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<int?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<int?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<int?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<long?> Sum(this IAsyncEnumerable<long?> source)
         {
             if (source == null)
@@ -262,6 +382,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<long?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<long?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<long?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<float?> Sum(this IAsyncEnumerable<float?> source)
         {
             if (source == null)
@@ -298,6 +438,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<float?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<float?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<float?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<double?> Sum(this IAsyncEnumerable<double?> source)
         {
             if (source == null)
@@ -334,6 +494,26 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<double?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<double?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<double?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
         public static Task<decimal?> Sum(this IAsyncEnumerable<decimal?> source)
         {
             if (source == null)
@@ -370,5 +550,25 @@ namespace System.Linq
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<decimal?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<decimal?> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<decimal?>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
     }
 }

+ 20 - 0
Ix.NET/Source/System.Interactive.Async/Sum.Generated.tt

@@ -71,6 +71,26 @@ foreach (var o in os)
             return source.Select(selector).Sum(cancellationToken);
         }
 
+        public static Task<<#=o.type#>> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<<#=o.type#>>> selector)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(CancellationToken.None);
+        }
+
+        public static Task<<#=o.type#>> Sum<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, Task<<#=o.type#>>> selector, CancellationToken cancellationToken)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (selector == null)
+                throw new ArgumentNullException(nameof(selector));
+
+            return source.Select(selector).Sum(cancellationToken);
+        }
+
 <#
 }
 #>