# DurableTaskExtensions.WhenEach(IEnumerable&lt;DurableTask&gt;)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskextensions/methods/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskExtensions.Combinators.cs)

```csharp
public static IAsyncEnumerable<ScheduledTask> WhenEach(this IEnumerable<DurableTask> tasks)
```

Schedules every input task and yields each input's handle once, in completion order, as the input reaches a terminal state.

### Parameters

- `tasks` (`IEnumerable<DurableTask>`): 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.
