# DurableTaskExtensions.Race(IEnumerable&lt;DurableTask&lt;TResult&gt;&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 DurableTask<(this int Index, TResult Result)> DurableTaskExtensions.Race<TResult>(IEnumerable<DurableTask<TResult>> tasks)
```

Creates a durable task which returns the input index and result of the first input task to complete, after requesting cancellation of every other input and waiting until each is terminal.

### Parameters

- `tasks` (`IEnumerable<DurableTask<TResult>>`): The input tasks, which are captured when this method is called.

### Returns

A combinator which, awaited within a durable execution, runs as part of that execution.

### Exceptions

- `System.ArgumentOutOfRangeException`: `tasks` is empty.
