Skip to content

DurableTask.Race(IReadOnlyList<DurableTask<TResult>>)

Race(IReadOnlyList<DurableTask<TResult>>)

static
View source
public static DurableTask<(int Index, TResult Result)> DurableTask.Race<TResult>(IReadOnlyList<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

tasksIReadOnlyList<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.