Task.WhenAny(Of TResult) Method (Task(Of 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)
'Declaration Public Shared Function WhenAny(Of TResult) ( _ ParamArray tasks As Task(Of TResult)() _ ) As Task(Of Task(Of TResult))
Type Parameters
- TResult
The type of the completed task.
Parameters
- tasks
- Type:
System.Threading.Tasks.Task(Of TResult)
()
The tasks to wait on for completion.
Return Value
Type: System.Threading.Tasks.Task(Of Task(Of 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: