AsyncEnumerable
Base abstract class that implements .
Use concrete implementation or .
Returns pre-cached empty collection
Helps to enumerate items in a collection asynchronously
IAsyncEnumerable<int> ProduceNumbers(int start, int end)
{
return new AsyncEnumerable<int>(async yield => {
for (int number = start; number <= end; number++)
await yield.ReturnAsync(number);
});
}
async Task ConsumeAsync()
{
var asyncEnumerableCollection = ProduceNumbers(start: 1, end: 10);
await asyncEnumerableCollection.ForEachAsync(async number => {
await Console.Out.WriteLineAsync(number);
});
}
A pre-cached empty collection
Constructor
A function that enumerates items in a collection asynchronously
Creates an enumerator that iterates through a collection asynchronously
A cancellation token to cancel creation of the enumerator in case if it takes a lot of time
Returns a task with the created enumerator as result on completion
Similar to , but allows you to pass a state object into the enumeration function, what can be
used for performance optimization, so don't have to create a delegate on the fly every single time you create the enumerator.
Type of items returned by
Type of the state object
Constructor
A function that enumerates items in a collection asynchronously
A state object that is passed to the
A user state that gets passed into the enumeration function.
Creates an enumerator that iterates through a collection asynchronously
Returns a task with the created enumerator as result on completion
Creates an enumerator that iterates through a collection asynchronously
Returns a task with the created enumerator as result on completion
This exception is thrown when you call
or when the enumerator is disposed before reaching the end of enumeration.
Base type for and
Returns an empty . Safe to use by multiple threads.
Helps to enumerate items in a collection asynchronously.
Provides exactly the same functionality as ,
but allows to pass a user state object in the enumeration function,
what can be used for performance optimization.
Constructor
A function that enumerates items in a collection asynchronously
Any state object that is passed to the
Optional action that gets invoked on Dispose()
Finalizer
A user state that gets passed into the enumeration function.
Gets the element in the collection at the current position of the enumerator
Tells if enumeration is complete. Returns True only after MoveNextAsync returns False.
Advances the enumerator to the next element of the collection asynchronously
Returns a Task that does transition to the next element. The result of the task is True if the enumerator was successfully advanced to the next element, or False if the enumerator has passed the end of the collection.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources
True if called from Dispose() method, otherwise False - called by GC
Helps to enumerate items in a collection asynchronously
An empty . Safe to use by multiple threads.
The asynchronous version of the 'yield' construction
Gets the cancellation token that was passed to the method
Yields an item asynchronously (similar to 'yield return' statement)
The item of the collection to yield
Returns a Task which tells if when you can continue to yield the next item
Stops iterating items in the collection (similar to 'yield break' statement)
Always throws this exception to stop the enumeration task
Constructor
A function that enumerates items in a collection asynchronously
Optional action that gets invoked on Dispose()
Internal implementation details
Converts generic IEnumerable to IAsyncEnumerable
Creates adapter for
The element type
The instance of to convert
If True the enumeration will be performed on the same thread, otherwise the MoveNext will be executed on a separate thread with Task.Run method
Returns an instance of implementation
Creates adapter for the enumerator of
The element type
The instance of to convert
If True the enumeration will be performed on the same thread, otherwise the MoveNext will be executed on a separate thread with Task.Run method
Returns an instance of implementation
Creates adapter for
The element type
The instance of to convert
If True the enumeration will be performed on the same thread, otherwise the MoveNext will be executed on a separate thread with Task.Run method
Returns an instance of implementation
Extension methods for for backward compatibility with version 1 of this libraray.
Not recommended to use.
Converts to .
This method is marked as [Obsolete] to discourage you from doing such conversion,
which defeats the whole purpose of having a non-blocking async enumeration,
and what might lead to dead-locks in ASP.NET or WPF applications.
Converts to .
This method is marked as [Obsolete] to discourage you from doing such conversion,
which defeats the whole purpose of having a non-blocking async enumeration,
and what might lead to dead-locks in ASP.NET or WPF applications.
Creates an enumerator that iterates through a collection synchronously.
This method is marked as [Obsolete] to discourage you from using this synchronous version of
the method instead of ,
what might lead to dead-locks in ASP.NET or WPF applications.
Class to provide access to static method.
Stops ForEachAsync iteration (similar to 'break' statement)
Always throws this exception to stop the ForEachAsync iteration
This exception is thrown when you call .
Enables asynchronous 'foreach' enumeration over an IAsyncEnumerable
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
A synchronous action to perform for every single item in the collection
A cancellation token to stop enumerating
Returns a Task which does enumeration over elements in the collection
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
A synchronous action to perform for every single item in the collection
Returns a Task which does enumeration over elements in the collection
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
A synchronous action to perform for every single item in the collection, where the second argument is the index of an item
A cancellation token to stop enumerating
Returns a Task which does enumeration over elements in the collection
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
A synchronous action to perform for every single item in the collection, where the second argument is the index of an item
Returns a Task which does enumeration over elements in the collection
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
An asynchronous action to perform for every single item in the collection
A cancellation token to stop enumerating
Returns a Task which does enumeration over elements in the collection
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
An asynchronous action to perform for every single item in the collection
Returns a Task which does enumeration over elements in the collection
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
An asynchronous action to perform for every single item in the collection, where the second argument is the index of an item
A cancellation token to stop enumerating
Returns a Task which does enumeration over elements in the collection
Enumerates over all elements in the collection asynchronously
The type of elements in the collection
The collection of elements which can be enumerated asynchronously
An asynchronous action to perform for every single item in the collection, where the second argument is the index of an item
Returns a Task which does enumeration over elements in the collection
Extension methods for interface
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
The type of the elements of .
An to return the single element of.
A that can halt enumeration of .
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
The type of the elements of .
An to return the single element of.
The message of an exception which is thrown when the source collection is empty.
The message of an exception which is thrown when the source collection has more than one element.
A that can halt enumeration of .
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.
The type of the elements of .
An to return the single element of.
Criteria predicate to select the only element.
A that can halt enumeration of .
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.
The type of the elements of .
An to return the single element of.
Criteria predicate to select the only element.
The message of an exception which is thrown when the source collection is has no element matching the criteria.
The message of an exception which is thrown when the source collection has more than one element matching the criteria.
A that can halt enumeration of .
Returns the only element of a sequence, and returns a default value if there is not exactly one element in the sequence.
The type of the elements of .
An to return the single element of.
A that can halt enumeration of .
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.
The type of the elements of .
An to return the single element of.
Criteria predicate to select the only element.
A that can halt enumeration of .
Returns the first element in the .
The type of the elements of
An to return an element from.
A that can halt enumeration of
Returns the first element in the .
The type of the elements of
An to return an element from.
An optional custom exception message for the case when the is empty
A that can halt enumeration of
Returns the first element in a sequence that satisfies a specified condition.
The type of the elements of
An to return an element from.
A function to test each element for a condition.
A that can halt enumeration of
Returns the first element in a sequence that satisfies a specified condition.
The type of the elements of
An to return an element from.
A function to test each element for a condition.
An optional custom exception message for the case when the is empty
A that can halt enumeration of
Returns the first element in the , or a default value if no element is found.
The type of the elements of
An to return an element from.
A that can halt enumeration of
Returns the first element in a sequence that satisfies a specified condition, or a default value if no element is found.
The type of the elements of
An to return an element from.
A function to test each element for a condition.
A that can halt enumeration of
Projects each element of a sequence into a new form.
The type of the elements of
The type of the value returned by .
A sequence of values to invoke a transform function on.
A transform function to apply to each element.
Projects each element of a sequence into a new form.
The type of the elements of
The type of the value returned by .
A sequence of values to invoke a transform function on.
A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
Projects each element of a sequence to an IAsyncEnumerable<T> and flattens the resulting sequences into one sequence.
The type of the elements of .
The type of the value in the IAsyncEnumerable returned by .
A sequence of values to invoke a transform function on.
A transform function to apply to each source element.
Projects each element of a sequence to an IAsyncEnumerable<T> and flattens the resulting sequences into one sequence.
The type of the elements of .
The type of the intermediate elements collected by .
The type of the elements of the resulting sequence by .
A sequence of values to invoke a transform function on.
A transform function to apply to each element of the input sequence.
A transform function to apply to each element of the intermediate sequence.
Projects each element of a sequence to an IAsyncEnumerable<T> and flattens the resulting sequences into one sequence.
The type of the elements of .
The type of the value in the IAsyncEnumerable returned by .
A sequence of values to invoke a transform function on.
A transform function to apply to each source element.
Projects each element of a sequence to an IAsyncEnumerable<T> and flattens the resulting sequences into one sequence.
The type of the elements of .
The type of the intermediate elements collected by .
The type of the elements of the resulting sequence by .
A sequence of values to invoke a transform function on.
A transform function to apply to each element of the input sequence.
A transform function to apply to each element of the intermediate sequence.
Returns a specified number of contiguous elements from the start of a sequence.
The type of the elements of
A sequence to return elements from.
The number of elements to return.
Returns elements from a sequence as long as a specified condition is true.
The type of the elements of
A sequence to return elements from.
A function to test each element for a condition.
Creates a list of elements asynchronously from the enumerable source
The type of the elements of source
The collection of elements
A cancellation token to cancel the async operation
Creates an array of elements asynchronously from the enumerable source
The type of the elements of source
The collection of elements
A cancellation token to cancel the async operation
Creates a from an according to a specified key selector function, a comparer, and an element selector function.
The type of the elements of .
The type of the key returned by .
An to create a from.
A function to extract a key from each element.
A cancellation token to cancel the async operation.
Creates a from an according to a specified key selector function, a comparer, and an element selector function.
The type of the elements of .
The type of the key returned by .
An to create a from.
A function to extract a key from each element.
An to compare keys.
A cancellation token to cancel the async operation.
Creates a from an according to a specified key selector function, a comparer, and an element selector function.
The type of the elements of .
The type of the key returned by .
The type of the value returned by .
An to create a from.
A function to extract a key from each element.
A transform function to produce a result element value from each element.
A cancellation token to cancel the async operation.
Creates a from an according to a specified key selector function, a comparer, and an element selector function.
The type of the elements of .
The type of the key returned by .
The type of the value returned by .
An to create a from.
A function to extract a key from each element.
A transform function to produce a result element value from each element.
An to compare keys.
A cancellation token to cancel the async operation.
Creates a from an according to a specified key selector function.
The type of the elements of .
The type of the key returned by .
The to create a from.
A function to extract a key from each element.
A cancellation token to cancel the async operation.
Creates a from an according to a specified key selector function and key comparer.
The type of the elements of .
The type of the key returned by .
The to create a from.
A function to extract a key from each element.
An to compare keys.
A cancellation token to cancel the async operation.
Creates a from an according to a specified key selector function and an element selector function.
The type of the elements of .
The type of the key returned by .
The type of the value returned by .
The to create a from.
A function to extract a key from each element.
A transform function to produce a result element value from each element.
A cancellation token to cancel the async operation.
Creates a from an according to a specified key selector function, a comparer and an element selector function.
The type of the elements of .
The type of the key returned by .
The type of the value returned by .
The to create a from.
A function to extract a key from each element.
A transform function to produce a result element value from each element.
An to compare keys.
A cancellation token to cancel the async operation.
An to return elements from.
The type of the elements of
An to return elements from.
The number of elements to skip before returning the remaining elements.
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
The type of the elements of
An to return elements from.
A function to test each element for a condition.
Filters a sequence of values based on a predicate.
The type of the elements of
An to filter.
A function to test each element for a condition.
Projects each element of a sequence into a new form.
The type of the elements of
An to filter.
A function to test each element for a condition; the second parameter of the function represents the index of the source element.
Casts the elements of an to the specified type.
The type to cast the elements of to.
An that contains the elements to be cast to type .
Filters the elements of an based on a specified type.
The type to filter the elements of the sequence on.
The whose elements to filter.
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
The type of the elements of .
The sequence to return the specified value for if it is empty.
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
The type of the elements of .
The sequence to return the specified value for if it is empty.
The value to return if the sequence is empty.
Splits the input collection into series of batches.
The type of the elements of
An to batch.
The maximum number of elements to put in a batch.
Splits the input collection into series of batches.
The type of the elements of
The type of a .NET's standard collection that forms a batch. Supported types are:
, , , ,
, , ,
, , .
An to batch.
The maximum number of elements to put in a batch.
Splits the input collection into series of batches.
The type of the elements of
An to batch.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Splits the input collection into series of batches.
The type of the elements of
The type of a .NET's standard collection that forms a batch. Supported types are:
, , , ,
, , ,
, , .
An to batch.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Splits the input collection into series of batches.
The type of the elements of
An to batch.
The maximum number of elements to put in a batch regardless their total weight.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Splits the input collection into series of batches.
The type of the elements of
The type of a .NET's standard collection that forms a batch. Supported types are:
, , , ,
, , ,
, , .
An to batch.
The maximum number of elements to put in a batch regardless their total weight.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Splits the input collection into series of batches.
The type of the elements of
The type of a batch of elements.
An to batch.
The maximum number of elements to put in a batch regardless their total weight.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
A function that creates a new batch with optional suggested capacity.
An action that adds an element to a batch.
Produces the set union of two sequences, which includes duplicate elements.
The type of the elements of the input sequences.
An whose elements form the first set for the union.
An whose elements form the second set for the union.
Produces the set union of multiple sequences, which includes duplicate elements.
The type of the elements of the input sequences.
A set of whose elements form the union.
Creates a new sequence based on input one plus an extra element at the end.
The type of the elements of .
An to return the single element of.
An extra element to be returned on enumeration.
Creates a new sequence based on input one plus an extra element in the beginning.
The type of the elements of .
An to return the single element of.
An extra element to be returned on enumeration.
Concatenates two sequences.
The type of the elements of the input sequences.
The first sequence to concatenate.
The sequence to concatenate to the first sequence.
Returns distinct elements from a sequence by using the default equality comparer to compare values.
The type of the elements of .
The sequence to remove duplicate elements from.
Returns distinct elements from a sequence by using a specified to compare values.
The type of the elements of .
The sequence to remove duplicate elements from.
An to compare values.
Applies an accumulator function over a sequence.
The type of the elements of .
An to aggregate over.
An accumulator function to be invoked on each element.
A cancellation token to cancel the async operation.
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
The type of the elements of .
The type of the accumulator value.
An to aggregate over.
The initial accumulator value.
An accumulator function to be invoked on each element.
A cancellation token to cancel the async operation.
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
The type of the elements of .
The type of the accumulator value.
The type of the resulting value.
An to aggregate over.
The initial accumulator value.
An accumulator function to be invoked on each element.
A function to transform the final accumulator value into the result value.
A cancellation token to cancel the async operation.
Determines whether all elements of a sequence satisfy a condition.
An that contains the elements to apply the predicate to.
A function to test each element for a condition.
A cancellation token to cancel the async operation.
The type of the elements of .
true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.
or is null.
Determines whether any element of a sequence exists or satisfies a condition.
An that contains the elements to apply the predicate to.
A function to test each element for a condition.
A cancellation token to cancel the async operation.
The type of the elements of .
true if any elements in the source sequence pass the test in the specified predicate; otherwise, false.
or is null.
Extension methods for interface
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
The type of the elements of .
An to return the single element of.
Flag to call the on input when this operation is complete
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
The type of the elements of .
An to return the single element of.
The message of an exception which is thrown when the source collection is empty.
The message of an exception which is thrown when the source collection has more than one element.
Flag to call the on input when this operation is complete
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.
The type of the elements of .
An to return the single element of.
Criteria predicate to select the only element.
Flag to call the on input when this operation is complete
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.
The type of the elements of .
An to return the single element of.
Criteria predicate to select the only element.
The message of an exception which is thrown when the source collection is has no element matching the criteria.
The message of an exception which is thrown when the source collection has more than one element matching the criteria.
Flag to call the on input when this operation is complete
Returns the only element of a sequence, and returns a default value if there is not exactly one element in the sequence.
The type of the elements of .
An to return the single element of.
Flag to call the on input when this operation is complete
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.
The type of the elements of .
An to return the single element of.
Criteria predicate to select the only element.
Flag to call the on input when this operation is complete
Returns the first element in the .
The type of the elements of
An to return an element from.
Flag to call the on input when this operation is complete
Returns the first element in the .
The type of the elements of
An to return an element from.
An optional custom exception message for the case when the is empty
Flag to call the on input when this operation is complete
Returns the first element in a sequence that satisfies a specified condition.
The type of the elements of
An to return an element from.
A function to test each element for a condition.
Flag to call the on input when this operation is complete
Returns the first element in a sequence that satisfies a specified condition.
The type of the elements of
An to return an element from.
A function to test each element for a condition.
An optional custom exception message for the case when the is empty
Flag to call the on input when this operation is complete
Returns the first element in the , or a default value if no element is found.
The type of the elements of
An to return an element from.
Flag to call the on input when this operation is complete
Returns the first element in a sequence that satisfies a specified condition, or a default value if no element is found.
The type of the elements of
An to return an element from.
A function to test each element for a condition.
Flag to call the on input when this operation is complete
Projects each element of a sequence into a new form.
The type of the elements of
The type of the value returned by .
A sequence of values to invoke a transform function on.
A transform function to apply to each element.
Flag to call the on input when enumeration is complete
Projects each element of a sequence into a new form.
The type of the elements of
The type of the value returned by .
A sequence of values to invoke a transform function on.
A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
Flag to call the on input when enumeration is complete
Returns a specified number of contiguous elements from the start of a sequence.
The type of the elements of
A sequence to return elements from.
The number of elements to return.
Flag to call the on input when enumeration is complete
Returns elements from a sequence as long as a specified condition is true.
The type of the elements of
A sequence to return elements from.
A function to test each element for a condition.
Flag to call the on input when enumeration is complete
Creates a list of elements asynchronously from the enumerable source
The type of the elements of source
The collection of elements
Flag to call the on input when this operation is complete
Creates an array of elements asynchronously from the enumerable source
The type of the elements of source
The collection of elements
Flag to call the on input when this operation is complete
An to return elements from.
The type of the elements of
An to return elements from.
The number of elements to skip before returning the remaining elements.
Flag to call the on input when enumeration is complete
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
The type of the elements of
An to return elements from.
A function to test each element for a condition.
Flag to call the on input when enumeration is complete
Filters a sequence of values based on a predicate.
The type of the elements of
An to filter.
A function to test each element for a condition.
Flag to call the on input when enumeration is complete
Projects each element of a sequence into a new form.
The type of the elements of
An to filter.
A function to test each element for a condition; the second parameter of the function represents the index of the source element.
Flag to call the on input when enumeration is complete
Casts the elements of an to the specified type.
The type to cast the elements of to.
An that contains the elements to be cast to type .
Flag to call the on input when enumeration is complete
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
The type of the elements of .
The sequence to return the specified value for if it is empty.
Flag to call the on input when enumeration is complete
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
The type of the elements of .
The sequence to return the specified value for if it is empty.
The value to return if the sequence is empty.
Flag to call the on input when enumeration is complete
Splits the input collection into series of batches.
The type of the elements of
An to batch.
The maximum number of elements to put in a batch.
Flag to call the on input when enumeration is complete
Splits the input collection into series of batches.
The type of the elements of
The type of a .NET's standard collection that forms a batch. Supported types are:
, , , ,
, , ,
, , .
An to batch.
The maximum number of elements to put in a batch.
Flag to call the on input when enumeration is complete
Splits the input collection into series of batches.
The type of the elements of
An to batch.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Flag to call the on input when enumeration is complete
Splits the input collection into series of batches.
The type of the elements of
The type of a .NET's standard collection that forms a batch. Supported types are:
, , , ,
, , ,
, , .
An to batch.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Flag to call the on input when enumeration is complete
Splits the input collection into series of batches.
The type of the elements of
An to batch.
The maximum number of elements to put in a batch regardless their total weight.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Flag to call the on input when enumeration is complete
Splits the input collection into series of batches.
The type of the elements of
The type of a .NET's standard collection that forms a batch. Supported types are:
, , , ,
, , ,
, , .
An to batch.
The maximum number of elements to put in a batch regardless their total weight.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
Flag to call the on input when enumeration is complete
Splits the input collection into series of batches.
The type of the elements of
The type of a batch of elements.
An to batch.
The maximum number of elements to put in a batch regardless their total weight.
The maximum logical weight of elements that a single batch can accomodate.
A function that computes a weight of a particular element, which is used to make a decision if it can fit into a batch.
A function that creates a new batch with optional suggested capacity.
An action that adds an element to a batch.
Flag to call the on input when enumeration is complete
Produces the set union of two sequences, which includes duplicate elements.
The type of the elements of the input sequences.
An whose elements form the first set for the union.
An whose elements form the second set for the union.
Flag to call the on input and when enumeration is complete.
Produces the set union of multiple sequences, which includes duplicate elements.
The type of the elements of the input sequences.
A set of whose elements form the union.
Flag to call the on all input when enumeration is complete.
Used in ParallelForEachAsync<T> extension method
Constructor
Extensions methods for IEnumerable and IAsyncEnumerable to do parallel for-each loop in async-await manner
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
If True (the default behavior), waits on completion for all started tasks when the loop breaks due to cancellation or an exception
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
If True (the default behavior), waits on completion for all started tasks when the loop breaks due to cancellation or an exception
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
If True (the default behavior), waits on completion for all started tasks when the loop breaks due to cancellation or an exception
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
If True (the default behavior), waits on completion for all started tasks when the loop breaks due to cancellation or an exception
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item, where first argument is the item and second argument is item's index in the collection
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Set to True to stop processing items when first exception occurs. The result might contain several exceptions though when faulty tasks finish at the same time.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Maximum items to schedule processing in parallel. The actual concurrency level depends on TPL settings. Set to 0 to choose a default value based on processor count.
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Invokes an asynchronous action on each item in the collection in parallel
The type of an item
The collection of items to perform actions on
An asynchronous action to perform on the item
Cancellation token
Wraps any exception(s) that occurred inside
Thrown when the loop is canceled with
Exposes an asynchronous enumerator, which supports a simple iteration over a non-generic collection
Creates an enumerator that iterates through a collection asynchronously
A cancellation token to cancel creation of the enumerator in case if it takes a lot of time
Returns a task with the created enumerator as result on completion
Supports a simple asynchronous iteration over a non-generic collection
Gets the current element in the collection.
Advances the enumerator to the next element of the collection asynchronously
Returns a Task that does transition to the next element. The result of the task is True if the enumerator was successfully advanced to the next element, or False if the enumerator has passed the end of the collection.
Internal base type for and
Utility methods for
Forcibly disables re-use of instances in the method.
This is just a safety switch in case when something goes wrong with re-using instances of .
Resets a to initial incomplete state.
This method by default re-uses the same instance of the by re-setting internal state of its using reflection.
If such feature is not available or explicitly disable with the method, it just returns a new instance of a .
Type of the result value
Target to be reset or recreated. It's safe to pass null.
Optional state object that you pass into constructor.