Method WhenAny
WhenAny(params Task[])
Waits until any of the specified tasks have completed.
NOTE: This will not cancel other tasks that have not finished running. Specify a common CancellationToken in each of the source tasks.
public static Task WhenAny(params Task[] tasks)
Parameters
tasksTask[]The tasks to wait on for completion.
Returns
WhenAny(IEnumerable<Task>)
Waits until any of the specified tasks have completed.
NOTE: This will not cancel other tasks that have not finished running. Specify a common CancellationToken in each of the source tasks.
public static Task WhenAny(IEnumerable<Task> tasks)
Parameters
tasksIEnumerable<Task>The tasks to wait on for completion.
Returns
WhenAny<TResult>(params Task<TResult>[])
Waits until any of the specified tasks have completed.
NOTE: This will not cancel other tasks that have not finished running. Specify a common CancellationToken in each of the source tasks.
public static Task<Task<TResult>> WhenAny<TResult>(params Task<TResult>[] tasks)
Parameters
tasksTask<TResult>[]The tasks to wait on for completion.
Returns
Type Parameters
TResult
WhenAny<TResult>(IEnumerable<Task<TResult>>)
Waits until any of the specified tasks have completed.
NOTE: This will not cancel other tasks that have not finished running. Specify a common CancellationToken in each of the source tasks.
public static Task<Task<TResult>> WhenAny<TResult>(IEnumerable<Task<TResult>> tasks)
Parameters
tasksIEnumerable<Task<TResult>>The tasks to wait on for completion.
Returns
Type Parameters
TResult