|
@@ -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>
|
|
|
{
|