System.Collections.Async.IAsyncEnumeratorExtensions
Extension methods for IAsyncEnumerator<T> interface
public static IAsyncEnumerator<List<TSource>> Batch<TSource>(this IAsyncEnumerator<TSource> source, int batchSize, bool disposeSource = true)
Splits the input collection into series of batches.
public static IAsyncEnumerator<TStandardCollection> Batch<TSource, TStandardCollection>(this IAsyncEnumerator<TSource> source, int batchSize, bool disposeSource = true)
Splits the input collection into series of batches.
public static IAsyncEnumerator<List<TSource>> Batch<TSource>(this IAsyncEnumerator<TSource> source, long maxBatchWeight, Func<TSource, long> weightSelector, bool disposeSource = true)
Splits the input collection into series of batches.
public static IAsyncEnumerator<TStandardCollection> Batch<TSource, TStandardCollection>(this IAsyncEnumerator<TSource> source, long maxBatchWeight, Func<TSource, long> weightSelector, bool disposeSource = true)
Splits the input collection into series of batches.
public static IAsyncEnumerator<List<TSource>> Batch<TSource>(this IAsyncEnumerator<TSource> source, int maxItemsInBatch, long maxBatchWeight, Func<TSource, long> weightSelector, bool disposeSource = true)
Splits the input collection into series of batches.
public static IAsyncEnumerator<TStandardCollection> Batch<TSource, TStandardCollection>(this IAsyncEnumerator<TSource> source, int maxItemsInBatch, long maxBatchWeight, Func<TSource, long> weightSelector, bool disposeSource = true)
Splits the input collection into series of batches.
public static IAsyncEnumerator<TBatch> Batch<TSource, TBatch>(this IAsyncEnumerator<TSource> source, int? maxItemsInBatch, long maxBatchWeight, Func<TSource, long> weightSelector, Func<int?, TBatch> createBatch, Action<TBatch, TSource> addItem, bool disposeSource = true)
Splits the input collection into series of batches.
public static IAsyncEnumerator<TResult> Cast<TResult>(this IAsyncEnumerator source, bool disposeSource = true)
Casts the elements of an IAsyncEnumerator to the specified type.
public static IAsyncEnumerator<TSource> DefaultIfEmpty<TSource>(this IAsyncEnumerator<TSource> source, bool disposeSource = true)
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
public static IAsyncEnumerator<TSource> DefaultIfEmpty<TSource>(this IAsyncEnumerator<TSource> source, TSource defaultValue, bool disposeSource = true)
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
public static Task<TSource> FirstAsync<TSource>(this IAsyncEnumerator<TSource> source, CancellationToken token = default, bool disposeSource = true)
Returns the first element in the IAsyncEnumerator<T>.
public static Task<TSource> FirstAsync<TSource>(this IAsyncEnumerator<TSource> source, string exceptionMessage, CancellationToken token = default, bool disposeSource = true)
Returns the first element in the IAsyncEnumerator<T>.
public static Task<TSource> FirstAsync<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, CancellationToken token = default, bool disposeSource = true)
Returns the first element in a sequence that satisfies a specified condition.
public static Task<TSource> FirstAsync<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, string exceptionMessage, CancellationToken token = default, bool disposeSource = true)
Returns the first element in a sequence that satisfies a specified condition.
public static Task<TSource> FirstOrDefaultAsync<TSource>(this IAsyncEnumerator<TSource> source, CancellationToken token = default, bool disposeSource = true)
Returns the first element in the IAsyncEnumerator<T>, or a default value if no element is found.
public static Task<TSource> FirstOrDefaultAsync<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, CancellationToken token = default, bool disposeSource = true)
Returns the first element in a sequence that satisfies a specified condition, or a default value if no element is found.
public static IAsyncEnumerator<TResult> Select<TSource, TResult>(this IAsyncEnumerator<TSource> source, Func<TSource, TResult> selector, bool disposeSource = true)
Projects each element of a sequence into a new form.
public static IAsyncEnumerator<TResult> Select<TSource, TResult>(this IAsyncEnumerator<TSource> source, Func<TSource, long, TResult> selector, bool disposeSource = true)
Projects each element of a sequence into a new form.
public static Task<TSource> SingleAsync<TSource>(this IAsyncEnumerator<TSource> source, CancellationToken token = default, bool disposeSource = true)
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
public static Task<TSource> SingleAsync<TSource>(this IAsyncEnumerator<TSource> source, string noneExceptionMessage, string manyExceptionMessage, CancellationToken token = default, bool disposeSource = true)
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
public static Task<TSource> SingleAsync<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, CancellationToken token = default, bool disposeSource = true)
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence that matches the criteria.
public static Task<TSource> SingleAsync<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, string noneExceptionMessage, string manyExceptionMessage, CancellationToken token = default, bool disposeSource = true)
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence that matches the criteria.
public static Task<TSource> SingleOrDefaultAsync<TSource>(this IAsyncEnumerator<TSource> source, CancellationToken token = default, bool disposeSource = true)
Returns the only element of a sequence, and returns a default value if there is not exactly one element in the sequence.
public static Task<TSource> SingleOrDefaultAsync<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, CancellationToken token = default, bool disposeSource = true)
Returns the only element of a sequence, and returns a default value if there is not exactly one element in the sequence that matches the criteria.
public static IAsyncEnumerator<TSource> Skip<TSource>(this IAsyncEnumerator<TSource> source, int count, bool disposeSource = true)
An IAsyncEnumerator<T> to return elements from.
public static IAsyncEnumerator<TSource> SkipWhile<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, bool disposeSource = true)
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
public static IAsyncEnumerator<TSource> Take<TSource>(this IAsyncEnumerator<TSource> source, int count, bool disposeSource = true)
Returns a specified number of contiguous elements from the start of a sequence.
public static IAsyncEnumerator<TSource> TakeWhile<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, bool disposeSource = true)
Returns elements from a sequence as long as a specified condition is true.
public static Task<T[]> ToArrayAsync<T>(this IAsyncEnumerator<T> source, CancellationToken cancellationToken = default, bool disposeSource = true)
Creates an array of elements asynchronously from the enumerable source
public static Task<List<T>> ToListAsync<T>(this IAsyncEnumerator<T> source, CancellationToken cancellationToken = default, bool disposeSource = true)
Creates a list of elements asynchronously from the enumerable source
public static IAsyncEnumerator<T> UnionAll<T>(this IAsyncEnumerator<T> first, IAsyncEnumerator<T> second, bool disposeSource = true)
Produces the set union of two sequences, which includes duplicate elements.
public static IAsyncEnumerator<T> UnionAll<T>(this IEnumerable<IAsyncEnumerator<T>> collections, bool disposeSource = true)
Produces the set union of multiple sequences, which includes duplicate elements.
public static IAsyncEnumerator<TSource> Where<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, bool> predicate, bool disposeSource = true)
Filters a sequence of values based on a predicate.
public static IAsyncEnumerator<TSource> Where<TSource>(this IAsyncEnumerator<TSource> source, Func<TSource, long, bool> predicate, bool disposeSource = true)
Projects each element of a sequence into a new form.