Task.WhenAny<TResult> Method (IEnumerable<Task<TResult>>)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Creates a task that will complete when any of the supplied tasks have completed.
Assembly: mscorlib (in mscorlib.dll)
Type Parameters
- TResult
The type of the completed task.
Parameters
- tasks
- Type: System.Collections.Generic.IEnumerable<Task<TResult>>
The tasks to wait on for completion.
Return Value
Type: System.Threading.Tasks.Task<Task<TResult>>A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed.
| Exception | Condition |
|---|---|
| ArgumentNullException | The tasks argument was null. |
| ArgumentException | The tasks array contained a null task, or was empty. |
Show: