public static IAwaitQuery<T> Await<T>(
this IEnumerable<Task<T>> source
)
<ExtensionAttribute>
Public Shared Function Await(Of T) (
source As IEnumerable(Of Task(Of T))
) As IAwaitQuery(Of T)
public:
[ExtensionAttribute]
generic<typename T>
static IAwaitQuery<T>^ Await(
IEnumerable<Task<T>^>^ source
)
[<ExtensionAttribute>]
static member Await :
source : IEnumerable<Task<'T>> -> IAwaitQuery<'T>
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.