ExperimentalEnumerableAwaitT(IEnumerableTaskT) Method

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

Definition

Namespace: MoreLinq.Experimental
Assembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
C#
public static IAwaitQuery<T> Await<T>(
	this IEnumerable<Task<T>> source
)

Parameters

source  IEnumerableTaskT
The source sequence of tasks.

Type Parameters

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

Return Value

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).

Remarks

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