Skip to content

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

Race(IEnumerable<DurableTask<TResult>>)

staticextension
View source
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

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