Click or drag to resize

ExperimentalEnumerableAwaitT Method (IEnumerableTaskT)

Creates a sequence query that streams the result of each task in the source sequence as it completes asynchronously.

Namespace:  MoreLinq.Experimental
Assembly:  MoreLinq (in MoreLinq.dll) Version: 3.0.0
public static IAwaitQuery<T> Await<T>(
	this IEnumerable<Task<T>> source


Type: System.Collections.GenericIEnumerableTaskT
The source sequence of tasks.

Type Parameters

The type of each task's result as well as the type of the elements of the resulting sequence.

Return Value

Type: IAwaitQueryT
A sequence query that streams the result of each task in source as it completes asynchronously.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTaskT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

This method uses deferred execution semantics. The results are yielded as each asynchronous task completes and, by default, not guaranteed to be based on the source sequence order. If order is important, compose further with AsOrderedT(IAwaitQueryT).

This method starts a new task where the tasks are awaited. If the resulting sequence is partially consumed then there's a good chance that some tasks will be wasted, those that are in flight.

The tasks in source are already assumed to be in flight therefore changing concurrency options via AsSequentialT(IAwaitQueryT), MaxConcurrencyT(IAwaitQueryT, Int32) or UnboundedConcurrencyT(IAwaitQueryT) will only change how many tasks are awaited at any given moment, not how many will be kept in flight. For the latter effect, use the other overload.

See Also