3internal static class QuerySourceExtensions
5 public static Dictionary<K, V> ToDictionary<K, V>(
this IQuerySource<ValueTuple<K, V>> src) where K : notnull =>
6 src.ToDictionary(t => t.Item1, t => t.Item2);
7 public static Task<Dictionary<K, V>> ToDictionaryAsync<K, V>(
this IQuerySource<ValueTuple<K, V>> src, CancellationToken cancel =
default) where K : notnull =>
8 src.ToDictionaryAsync(t => t.Item1, t => t.Item2, cancel);
10 public static Dictionary<K, V> ToDictionary<K, V>(
this IQuerySource<ValueTuple<K, V>> src, IEqualityComparer<K>? comparer) where K : notnull =>
11 src.ToDictionary(t => t.Item1, t => t.Item2, comparer);
12 public static Task<Dictionary<K, V>> ToDictionaryAsync<K, V>(
this IQuerySource<ValueTuple<K, V>> src, IEqualityComparer<K>? comparer, CancellationToken cancel =
default) where K : notnull =>
13 src.ToDictionaryAsync(t => t.Item1, t => t.Item2, comparer, cancel);
15 public static int Sum(
this IQuerySource<int> src) => src.Sum(x => x);
16 public static Task<int> SumAsync(
this IQuerySource<int> src, CancellationToken cancel =
default) =>
17 src.SumAsync(x => x, cancel);
19 public static long Sum(
this IQuerySource<long> src) => src.Sum(x => x);
20 public static Task<long> SumAsync(
this IQuerySource<long> src, CancellationToken cancel =
default) =>
21 src.SumAsync(x => x, cancel);
23 public static double Sum(
this IQuerySource<double> src) => src.Sum(x => x);
24 public static Task<double> SumAsync(
this IQuerySource<double> src, CancellationToken cancel =
default) =>
25 src.SumAsync(x => x, cancel);
27 public static double Average(
this IQuerySource<double> src) => src.Average(x => x);
28 public static Task<double> AverageAsync(
this IQuerySource<double> src, CancellationToken cancel =
default) =>
29 src.AverageAsync(x => x, cancel);