8 public async Task<List<T>>
ToListAsync(CancellationToken cancel =
default)
10 var ret =
new List<T>();
16 public async Task<T[]>
ToArrayAsync(CancellationToken cancel =
default) =>
20 public Task<HashSet<T>>
ToHashSetAsync(CancellationToken cancel =
default) =>
24 public async Task<HashSet<T>>
ToHashSetAsync(IEqualityComparer<T>? comparer, CancellationToken cancel =
default)
26 var ret =
new HashSet<T>(comparer);
31 public Dictionary<K, V>
ToDictionary<K, V>(Func<T, K> getKey, Func<T, V> getValue) where K : notnull =>
32 ToDictionary(getKey, getValue,
null);
33 public Task<Dictionary<K, V>>
ToDictionaryAsync<K, V>(Func<T, K> getKey, Func<T, V> getValue, CancellationToken cancel =
default) where K : notnull =>
34 ToDictionaryAsync(getKey, getValue,
null, cancel);
36 public Dictionary<K, V>
ToDictionary<K, V>(Func<T, K> getKey, Func<T, V> getValue, IEqualityComparer<K>? comparer) where K : notnull =>
38 public async Task<Dictionary<K, V>>
ToDictionaryAsync<K, V>(Func<T, K> getKey, Func<T, V> getValue, IEqualityComparer<K>? comparer, CancellationToken cancel =
default) where K : notnull
40 var ret =
new Dictionary<K, V>(comparer);
45 public record
struct QuerySourceEnumerable(
QuerySource<T> Source) : IEnumerable<T>
47 public IEnumerator<T> GetEnumerator()
49 var pe = Source.PaginateAsync().GetAsyncEnumerator();
52 var mv = pe.MoveNextAsync().AsTask();
56 var page = pe.Current;
58 foreach (var e
in page.Data)
63 mv = pe.MoveNextAsync().AsTask();
67 finally { pe.DisposeAsync(); }
70 IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
Task< Dictionary< K, V > > ToDictionaryAsync< K, V >(Func< T, K > getKey, Func< T, V > getValue, CancellationToken cancel=default)