# DurableTaskExtensions.WhenAllCompleted(IReadOnlyList&lt;ScheduledTask&lt;TResult&gt;&gt;, CancellationToken)

[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 Task<ScheduledTask<TResult>[]> WhenAllCompleted<TResult>(this IReadOnlyList<ScheduledTask<TResult>> tasks, CancellationToken cancellationToken = default(CancellationToken))
```

Waits until every scheduled task is terminal, and returns the tasks in input order.

### Parameters

- `tasks` (`IReadOnlyList<ScheduledTask<TResult>>`): The tasks, which are captured when this method is called.
- `cancellationToken` (`CancellationToken`): A token which abandons the wait. It doesn't cancel the tasks.

### Returns

The tasks, in input order. Each has observed its terminal response, so [ScheduledTask](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.scheduledtask/), [ScheduledTask](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.scheduledtask/), and `Orleans.Durable.Tasks.ScheduledTask-1.TryGetResult(-0@)` inspect it.
