DelayedTaskWhenAnyTResult Method (TaskTResult) |
Creates a task that will complete when any of the supplied tasks have completed.
Namespace: Rackspace.ThreadingAssembly: Rackspace.Threading (in Rackspace.Threading.dll) Version: 1.1.0.0
Syntax
public static Task<Task<TResult>> WhenAny<TResult>(
params Task<TResult>[] tasks
)
Public Shared Function WhenAny(Of TResult) (
ParamArray tasks As Task(Of TResult)()
) As Task(Of Task(Of TResult))
public:
generic<typename TResult>
static Task<Task<TResult>^>^ WhenAny(
... array<Task<TResult>^>^ tasks
)
static member WhenAny :
tasks : Task<'TResult>[] -> Task<Task<'TResult>>
Parameters
- tasks
- Type: System.Threading.TasksTaskTResult
The tasks to wait on for completion.
Type Parameters
- TResult
- The type of the completed task.
Return Value
Type:
TaskTaskTResultA task that represents the completion of one of the supplied tasks. The return task's
Result is the task that completed.
Exceptions
Remarks
The returned task will complete when any of the supplied tasks has completed. The returned
task will always end in the
RanToCompletion state with its
Result set to the first task to complete. This is true even if
the first task to complete ended in the
Canceled or
Faulted state.
Version Information
.NET for Windows Store apps
Supported in: Windows 8
.NET Framework
Supported in: 4.5, 4.0, 3.5
Portable Class Library
Supported in: Portable Class Library (Legacy), Portable Class Library
Rackspace Threading Library
Supported in: 1.1
See Also