Task.WhenAny Method (IEnumerable<Task>)
.NET Framework 4.5
Creates a task that will complete when any of the supplied tasks have completed.
Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
Parameters
- tasks
- Type: System.Collections.Generic.IEnumerable<Task>
The tasks to wait on for completion.
Return Value
Type: System.Threading.Tasks.Task<Task>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. |
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.