AsyncEnumerable
Provides extension methods for IAsyncEnumerable<T> interface.
public static Task<MemoryOwner<T>> CopyAsync<T>(this IAsyncEnumerable<T> enumerable, int sizeHint = 0, MemoryAllocator<T> allocator = null, CancellationToken token = default)
Creates a copy of the elements from the collection.
public static ValueTask<Optional<T>> ElementAtAsync<T>(this IAsyncEnumerable<T> collection, int index, CancellationToken token = default)
Obtains element at the specified index in the sequence.
Gets an empty asynchronous collection.
public static ValueTask<Optional<T>> FirstOrNoneAsync<T>(this IAsyncEnumerable<T> seq, CancellationToken token = default)
Obtains first element in the sequence; or None
if sequence is empty.
public static ValueTask<Optional<T>> FirstOrNoneAsync<T>(this IAsyncEnumerable<T> seq, Predicate<T> filter, CancellationToken token = default)
Returns the first element in a sequence that satisfies a specified condition.
public static ValueTask<T?> FirstOrNullAsync<T>(this IAsyncEnumerable<T> seq, CancellationToken token = default) where T : struct
Obtains first value type in the sequence; or null
if sequence is empty.
public static ValueTask ForEachAsync<T>(this IAsyncEnumerable<T> collection, Action<T> action, CancellationToken token = default)
Applies specified action to each collection element asynchronously.
public static ValueTask ForEachAsync<T>(this IAsyncEnumerable<T> collection, Func<T, CancellationToken, ValueTask> action, CancellationToken token = default)
Applies specified action to each collection element asynchronously.
public static ValueTask<Optional<T>> LastOrNoneAsync<T>(this IAsyncEnumerable<T> seq, CancellationToken token = default)
Obtains the last element in the sequence; or None
if sequence is empty.
public static ValueTask<T?> LastOrNullAsync<T>(this IAsyncEnumerable<T> seq, CancellationToken token = default) where T : struct
Obtains the last value type in the sequence; or null
if sequence is empty.
Bypasses a specified number of elements in a sequence.
Skip null values in the collection.
Gets an asynchronous collection that throws the specified exception.
public static Task<T[]> ToArrayAsync<T>(this IAsyncEnumerable<T> collection, int initialCapacity = 10, MemoryAllocator<T> allocator = null, CancellationToken token = default)
Converts asynchronous collection to the array.