Skip to content

DurableTaskExtensions.WhenEach(IEnumerable<DurableTask<TResult>>)

WhenEach(IEnumerable<DurableTask<TResult>>)

staticextension
View source
public static IAsyncEnumerable<ScheduledTask<TResult>> WhenEach<TResult>(this IEnumerable<DurableTask<TResult>> tasks)
Schedules every input task and yields each input's handle once, in completion order, as the input reaches a terminal state.

Parameters

tasksIEnumerable<DurableTask<TResult>>
The input tasks, which are captured when this method is called.

Returns

The inputs' handles in completion order. Each yielded handle has observed its terminal response, including a failure or a cancellation, which doesn't fail the enumeration.

Exceptions

System.InvalidOperationException
The method is called outside a durable execution.