Επεξεργασία

Κοινή χρήση μέσω


TaskFactory<TResult>.ContinueWhenAny Method

Definition

Creates a continuation task that will be started upon the completion of any task in the provided set.

Overloads

ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny(Task[], Func<Task,TResult>)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny(Task[], Func<Task,TResult>, TaskContinuationOptions)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken)

Creates a continuation task that will be started upon the completion of any task in the provided set.

ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task ^> ^ tasks, Func<System::Threading::Tasks::Task ^, TResult> ^ continuationFunction, System::Threading::CancellationToken cancellationToken, System::Threading::Tasks::TaskContinuationOptions continuationOptions, System::Threading::Tasks::TaskScheduler ^ scheduler);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny (System.Threading.Tasks.Task[] tasks, Func<System.Threading.Tasks.Task,TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler);
member this.ContinueWhenAny : System.Threading.Tasks.Task[] * Func<System.Threading.Tasks.Task, 'Result> * System.Threading.CancellationToken * System.Threading.Tasks.TaskContinuationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny (tasks As Task(), continuationFunction As Func(Of Task, TResult), cancellationToken As CancellationToken, continuationOptions As TaskContinuationOptions, scheduler As TaskScheduler) As Task(Of TResult)

Parameters

tasks
Task[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

The cancellation token that will be assigned to the new continuation task.

continuationOptions
TaskContinuationOptions

One of the enumeration values that controls the behavior of the created continuation task. The NotOn* and OnlyOn* values are not valid.

scheduler
TaskScheduler

The task scheduler that is used to schedule the created continuation task.

Returns

The new continuation task.

Exceptions

The tasks array is null.

-or-

The continuationFunction argument is null.

-or-

The scheduler argument is null.

The tasks array contains a null value.

-or-

The tasks array is empty.

The continuationOptions argument specifies an invalid TaskContinuationOptions value.

One of the elements in the tasks array has been disposed.

-or-

The CancellationTokenSource that created cancellationToken has already been disposed.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to

ContinueWhenAny(Task[], Func<Task,TResult>)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task ^> ^ tasks, Func<System::Threading::Tasks::Task ^, TResult> ^ continuationFunction);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny (System.Threading.Tasks.Task[] tasks, Func<System.Threading.Tasks.Task,TResult> continuationFunction);
member this.ContinueWhenAny : System.Threading.Tasks.Task[] * Func<System.Threading.Tasks.Task, 'Result> -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny (tasks As Task(), continuationFunction As Func(Of Task, TResult)) As Task(Of TResult)

Parameters

tasks
Task[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

Returns

The new continuation task.

Exceptions

One of the elements in the tasks array has been disposed.

The tasks array is null.

-or-

The continuationFunction argument is null.

The tasks array contains a null value or is empty.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to

ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task ^> ^ tasks, Func<System::Threading::Tasks::Task ^, TResult> ^ continuationFunction, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny (System.Threading.Tasks.Task[] tasks, Func<System.Threading.Tasks.Task,TResult> continuationFunction, System.Threading.CancellationToken cancellationToken);
member this.ContinueWhenAny : System.Threading.Tasks.Task[] * Func<System.Threading.Tasks.Task, 'Result> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny (tasks As Task(), continuationFunction As Func(Of Task, TResult), cancellationToken As CancellationToken) As Task(Of TResult)

Parameters

tasks
Task[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

The cancellation token that will be assigned to the new continuation task.

Returns

The new continuation task.

Exceptions

One of the elements in the tasks array has been disposed.

-or-

The CancellationTokenSource that created cancellationToken has already been disposed.

The tasks array is null.

-or-

The continuationFunction argument is null.

The tasks array contains a null value.

-or-

The tasks array is empty.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to

ContinueWhenAny(Task[], Func<Task,TResult>, TaskContinuationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task ^> ^ tasks, Func<System::Threading::Tasks::Task ^, TResult> ^ continuationFunction, System::Threading::Tasks::TaskContinuationOptions continuationOptions);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny (System.Threading.Tasks.Task[] tasks, Func<System.Threading.Tasks.Task,TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions);
member this.ContinueWhenAny : System.Threading.Tasks.Task[] * Func<System.Threading.Tasks.Task, 'Result> * System.Threading.Tasks.TaskContinuationOptions -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny (tasks As Task(), continuationFunction As Func(Of Task, TResult), continuationOptions As TaskContinuationOptions) As Task(Of TResult)

Parameters

tasks
Task[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

continuationOptions
TaskContinuationOptions

One of the enumeration values that controls the behavior of the created continuation task. The NotOn* and OnlyOn* values are not valid.

Returns

The new continuation task.

Exceptions

One of the elements in the tasks array has been disposed.

The tasks array is null.

-or-

The continuationFunction argument is null.

The continuationOptions argument specifies an invalid enumeration value.

The tasks array contains a null value.

-or-

The tasks array is empty.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
generic <typename TAntecedentResult>
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Func<System::Threading::Tasks::Task<TAntecedentResult> ^, TResult> ^ continuationFunction, System::Threading::CancellationToken cancellationToken, System::Threading::Tasks::TaskContinuationOptions continuationOptions, System::Threading::Tasks::TaskScheduler ^ scheduler);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Func<System.Threading.Tasks.Task<TAntecedentResult>,TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Func<System.Threading.Tasks.Task<'AntecedentResult>, 'Result> * System.Threading.CancellationToken * System.Threading.Tasks.TaskContinuationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny(Of TAntecedentResult) (tasks As Task(Of TAntecedentResult)(), continuationFunction As Func(Of Task(Of TAntecedentResult), TResult), cancellationToken As CancellationToken, continuationOptions As TaskContinuationOptions, scheduler As TaskScheduler) As Task(Of TResult)

Type Parameters

TAntecedentResult

The type of the result of the antecedent tasks.

Parameters

tasks
Task<TAntecedentResult>[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

The cancellation token that will be assigned to the new continuation task.

continuationOptions
TaskContinuationOptions

One of the enumeration values that controls the behavior of the created continuation task. The NotOn* and OnlyOn* values are not valid.

scheduler
TaskScheduler

The TaskScheduler that is used to schedule the created continuation Task<TResult>.

Returns

The new continuation Task<TResult>.

Exceptions

The tasks array is null.

-or-

The continuationFunction argument is null.

-or-

The scheduler argument is null.

The tasks array contains a null value.

-or-

The tasks array is empty.

The continuationOptions argument specifies an invalid TaskContinuationOptions value.

One of the elements in the tasks array has been disposed.

-or-

The CancellationTokenSource that created cancellationToken has already been disposed.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
generic <typename TAntecedentResult>
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Func<System::Threading::Tasks::Task<TAntecedentResult> ^, TResult> ^ continuationFunction, System::Threading::Tasks::TaskContinuationOptions continuationOptions);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Func<System.Threading.Tasks.Task<TAntecedentResult>,TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Func<System.Threading.Tasks.Task<'AntecedentResult>, 'Result> * System.Threading.Tasks.TaskContinuationOptions -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny(Of TAntecedentResult) (tasks As Task(Of TAntecedentResult)(), continuationFunction As Func(Of Task(Of TAntecedentResult), TResult), continuationOptions As TaskContinuationOptions) As Task(Of TResult)

Type Parameters

TAntecedentResult

The type of the result of the antecedent tasks.

Parameters

tasks
Task<TAntecedentResult>[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

continuationOptions
TaskContinuationOptions

One of the enumeration values that controls the behavior of the created continuation task. The NotOn* and OnlyOn* values are not valid.

Returns

The new continuation Task<TResult>.

Exceptions

One of the elements in the tasks array has been disposed.

The tasks array is null.

-or-

The continuationFunction argument is null.

The continuationOptions argument specifies an invalid enumeration value.

The tasks array contains a null value.

-or-

The tasks array is empty.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
generic <typename TAntecedentResult>
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Func<System::Threading::Tasks::Task<TAntecedentResult> ^, TResult> ^ continuationFunction);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Func<System.Threading.Tasks.Task<TAntecedentResult>,TResult> continuationFunction);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Func<System.Threading.Tasks.Task<'AntecedentResult>, 'Result> -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny(Of TAntecedentResult) (tasks As Task(Of TAntecedentResult)(), continuationFunction As Func(Of Task(Of TAntecedentResult), TResult)) As Task(Of TResult)

Type Parameters

TAntecedentResult

The type of the result of the antecedent tasks.

Parameters

tasks
Task<TAntecedentResult>[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

Returns

The new continuation Task<TResult>.

Exceptions

One of the elements in the tasks array has been disposed.

The tasks array is null.

-or-

The continuationFunction argument is null.

The tasks array contains a null value.

-or-

The tasks array is empty.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Creates a continuation task that will be started upon the completion of any task in the provided set.

public:
generic <typename TAntecedentResult>
 System::Threading::Tasks::Task<TResult> ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Func<System::Threading::Tasks::Task<TAntecedentResult> ^, TResult> ^ continuationFunction, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Func<System.Threading.Tasks.Task<TAntecedentResult>,TResult> continuationFunction, System.Threading.CancellationToken cancellationToken);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Func<System.Threading.Tasks.Task<'AntecedentResult>, 'Result> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
Public Function ContinueWhenAny(Of TAntecedentResult) (tasks As Task(Of TAntecedentResult)(), continuationFunction As Func(Of Task(Of TAntecedentResult), TResult), cancellationToken As CancellationToken) As Task(Of TResult)

Type Parameters

TAntecedentResult

The type of the result of the antecedent tasks.

Parameters

tasks
Task<TAntecedentResult>[]

The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

The cancellation token that will be assigned to the new continuation task.

Returns

The new continuation task.

Exceptions

One of the elements in the tasks array has been disposed.

-or-

The CancellationTokenSource that created cancellationToken has already been disposed.

The tasks array is null.

-or-

The continuationFunction argument is null.

The tasks array contains a null value.

-or-

The tasks array is empty.

Remarks

After completion, a task is in one of these states: RanToCompletion, Faulted, or Canceled states.

See also

Applies to