TaskFactory.ContinueWhenAny Méthode

Définition

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

Surcharges

ContinueWhenAny(Task[], Action<Task>, TaskContinuationOptions)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

ContinueWhenAny(Task[], Action<Task>)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

ContinueWhenAny(Task[], Action<Task>, CancellationToken)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, TaskContinuationOptions)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

ContinueWhenAny(Task[], Action<Task>, TaskContinuationOptions)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

ou-or- continuationAction est null.continuationAction is null.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

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

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

public:
 System::Threading::Tasks::Task ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task ^> ^ tasks, Action<System::Threading::Tasks::Task ^> ^ continuationAction, System::Threading::CancellationToken cancellationToken, System::Threading::Tasks::TaskContinuationOptions continuationOptions, System::Threading::Tasks::TaskScheduler ^ scheduler);
public System.Threading.Tasks.Task ContinueWhenAny (System.Threading.Tasks.Task[] tasks, Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler);
member this.ContinueWhenAny : System.Threading.Tasks.Task[] * Action<System.Threading.Tasks.Task> * System.Threading.CancellationToken * System.Threading.Tasks.TaskContinuationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.Task

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task.

scheduler
TaskScheduler

TaskScheduler utilisé pour planifier la Task de continuation créée.The TaskScheduler that is used to schedule the created continuation Task.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

Le tableau tasks a la valeur null.The tasks array is null.

ou-or- continuationAction est null.continuationAction is null.

- ou --or- scheduler a la valeur null.scheduler is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le CancellationToken fourni a déjà été supprimé.The provided CancellationToken has already been disposed.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

ContinueWhenAny(Task[], Action<Task>)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- L'argument continuationAction a la valeur null.The continuationAction argument is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Exemples

L’exemple suivant montre comment utiliser ContinueWhenAny et ContinueWhenAll :The following example shows how to use ContinueWhenAny and ContinueWhenAll:

using System;
using System.Threading;
using System.Threading.Tasks;

class ContinueWhenMultiDemo
{
    // Demonstrated features:
    // 		Task.Factory
    //		TaskFactory.ContinueWhenAll()
    //		TaskFactory.ContinueWhenAny()
    //		Task.Wait()
    // Expected results:
    // 		Three tasks are created in parallel. 
    //		Each task for a different period of time prints a number and returns it.
    //      A ContinueWhenAny() task indicates the first of the three tasks to complete.
    //      A ContinueWhenAll() task sums up the results of the three tasks and prints out the total.
    // Documentation:
    //		http://msdn.microsoft.com/library/system.threading.tasks.taskfactory_members(VS.100).aspx
    static void Main()
    {
        // Schedule a list of tasks that return integer
        Task<int>[] tasks = new Task<int>[]
            {
                Task<int>.Factory.StartNew(() => 
                    {
                        Thread.Sleep(500);
                        Console.WriteLine("Task={0}, Thread={1}, x=5", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
                        return 5;
                    }),

                Task<int>.Factory.StartNew(() => 
                    {
                        Thread.Sleep(10);
                        Console.WriteLine("Task={0}, Thread={1}, x=3", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
                        return 3;
                    }),

                Task<int>.Factory.StartNew(() => 
                    {
                        Thread.Sleep(200);
                        Console.WriteLine("Task={0}, Thread={1}, x=2", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
                        return 2;
                    })
            };

        // Schedule a continuation to indicate the result of the first task to complete
        Task.Factory.ContinueWhenAny(tasks, winner =>
        {
            // You would expect winning result = 3 on multi-core systems, because you expect
            // tasks[1] to finish first.
            Console.WriteLine("Task={0}, Thread={1} (ContinueWhenAny): Winning result = {2}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId, winner.Result);
        });


        // Schedule a continuation that sums up the results of all tasks, then wait on it.
        // The list of antecendent tasks is passed as an argument by the runtime.
        Task.Factory.ContinueWhenAll(tasks,
            (antecendents) =>
            {
                int sum = 0;
                foreach (Task<int> task in antecendents)
                {
                    sum += task.Result;
                }

                Console.WriteLine("Task={0}, Thread={1}, (ContinueWhenAll): Total={2} (expected 10)", Task.CurrentId, Thread.CurrentThread.ManagedThreadId, sum);
            })
            .Wait();
    }
}
Imports System.Threading
Imports System.Threading.Tasks

Module ContinuationWhenMulti
    ' Demonstrated features:
    '   Task.Factory
    '   TaskFactory.ContinueWhenAll()
    '   TaskFactory.ContinueWhenAny()
    '   Task.Wait()
    ' Expected results:
    '   Three tasks are created in parallel. 
    '   Each task for a different period of time prints a number and returns it.
    '   A ContinueWhenAny() task indicates the first of the three tasks to complete.
    '   A ContinueWhenAll() task sums up the results of the three tasks and prints out the total.
    ' Documentation:
    '   http://msdn.microsoft.com/library/system.threading.tasks.taskfactory_members(VS.100).aspx
    Sub Main()
        ' Schedule a list of tasks that return integer
        Dim tasks As Task(Of Integer)() = New Task(Of Integer)() {
            Task(Of Integer).Factory.StartNew(Function()
                                                  Thread.Sleep(500)
                                                  Console.WriteLine("Task={0}, Thread={1}, x=5", Task.CurrentId, Thread.CurrentThread.ManagedThreadId)
                                                  Return 5
                                              End Function),
            Task(Of Integer).Factory.StartNew(Function()
                                                  Thread.Sleep(10)
                                                  Console.WriteLine("Task={0}, Thread={1}, x=3", Task.CurrentId, Thread.CurrentThread.ManagedThreadId)
                                                  Return 3
                                              End Function),
            Task(Of Integer).Factory.StartNew(Function()
                                                  Thread.Sleep(200)
                                                  Console.WriteLine("Task={0}, Thread={1}, x=2", Task.CurrentId, Thread.CurrentThread.ManagedThreadId)
                                                  Return 2
                                              End Function)}


        ' Schedule a continuation to indicate the result of the first task to complete
        Task.Factory.ContinueWhenAny(tasks, Sub(winner)
                                                ' You would expect winning result = 3 on multi-core systems, because you expect
                                                ' tasks[1] to finish first.
                                                Console.WriteLine("Task={0}, Thread={1} (ContinueWhenAny): Winning result = {2}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId, winner.Result)
                                            End Sub)


        ' Schedule a continuation that sums up the results of all tasks, then wait on it.
        ' The list of antecendent tasks is passed as an argument by the runtime.
        Task.Factory.ContinueWhenAll(tasks, Sub(antecendents)
                                                Dim sum As Integer = 0
                                                For Each task__1 As Task(Of Integer) In antecendents
                                                    sum += task__1.Result
                                                Next
                                                Console.WriteLine("Task={0}, Thread={1}, (ContinueWhenAll): Total={2} (expected 10)", Task.CurrentId, Thread.CurrentThread.ManagedThreadId, sum)
                                            End Sub).Wait()
    End Sub
End Module

Voir aussi

ContinueWhenAny(Task[], Action<Task>, CancellationToken)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task that will be started upon the completion of any Task in the provided set.

public:
 System::Threading::Tasks::Task ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task ^> ^ tasks, Action<System::Threading::Tasks::Task ^> ^ continuationAction, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task ContinueWhenAny (System.Threading.Tasks.Task[] tasks, Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken);
member this.ContinueWhenAny : System.Threading.Tasks.Task[] * Action<System.Threading.Tasks.Task> * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

- ou --or- cancellationToken a déjà été supprimé.cancellationToken has already been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- L'argument continuationAction a la valeur null.The continuationAction argument is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty .

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TAntecedentResult, typename TResult>
 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,TResult> (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, TResult) (tasks As Task(Of TAntecedentResult)(), continuationFunction As Func(Of Task(Of TAntecedentResult), TResult), continuationOptions As TaskContinuationOptions) As Task(Of TResult)

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task<TResult> de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task<TResult>.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

ou-or- continuationFunction a la valeur null.continuationFunction is null.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

ou-or- Le tableau tasks est vide.The tasks array is empty.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TAntecedentResult, typename TResult>
 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,TResult> (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, TResult) (tasks As Task(Of TAntecedentResult)(), continuationFunction As Func(Of Task(Of TAntecedentResult), TResult)) As Task(Of TResult)

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- continuationFunction est null.continuationFunction is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TAntecedentResult, typename TResult>
 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,TResult> (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>

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

- ou --or- Le CancellationToken fourni a déjà été supprimé.The provided CancellationToken has already been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- continuationFunction est null.continuationFunction is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TAntecedentResult, typename TResult>
 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,TResult> (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>

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task<TAntecedentResult>,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task<TResult> de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task<TResult>.

scheduler
TaskScheduler

TaskScheduler utilisé pour planifier la Task<TResult> de continuation créée.The TaskScheduler that is used to schedule the created continuation Task<TResult>.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

Le tableau tasks a la valeur null.The tasks array is null.

ou-or- continuationFunction est null.continuationFunction is null.

- ou --or- scheduler a la valeur null.scheduler is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

ou-or- Le tableau tasks est vide.The tasks array is empty.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le CancellationToken fourni a déjà été supprimé.The provided CancellationToken has already been disposed.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.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 ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Action<System::Threading::Tasks::Task<TAntecedentResult> ^> ^ continuationAction);
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Action<System.Threading.Tasks.Task<'AntecedentResult>> -> System.Threading.Tasks.Task
Public Function ContinueWhenAny(Of TAntecedentResult) (tasks As Task(Of TAntecedentResult)(), continuationAction As Action(Of Task(Of TAntecedentResult))) As Task

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task<TAntecedentResult>>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

ou-or- continuationAction a la valeur null.continuationAction is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Voir aussi

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.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 ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Action<System::Threading::Tasks::Task<TAntecedentResult> ^> ^ continuationAction, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Action<System.Threading.Tasks.Task<'AntecedentResult>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task<TAntecedentResult>>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

- ou --or- Le CancellationToken fourni a déjà été supprimé.The provided CancellationToken has already been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- continuationAction a la valeur null.continuationAction is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Voir aussi

ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, TaskContinuationOptions)

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.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 ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Action<System::Threading::Tasks::Task<TAntecedentResult> ^> ^ continuationAction, System::Threading::Tasks::TaskContinuationOptions continuationOptions);
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Action<System.Threading.Tasks.Task<'AntecedentResult>> * System.Threading.Tasks.TaskContinuationOptions -> System.Threading.Tasks.Task
Public Function ContinueWhenAny(Of TAntecedentResult) (tasks As Task(Of TAntecedentResult)(), continuationAction As Action(Of Task(Of TAntecedentResult)), continuationOptions As TaskContinuationOptions) As Task

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task<TAntecedentResult>>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- continuationAction a la valeur null.continuationAction is null.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

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

Crée une Task de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.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 ^ ContinueWhenAny(cli::array <System::Threading::Tasks::Task<TAntecedentResult> ^> ^ tasks, Action<System::Threading::Tasks::Task<TAntecedentResult> ^> ^ continuationAction, System::Threading::CancellationToken cancellationToken, System::Threading::Tasks::TaskContinuationOptions continuationOptions, System::Threading::Tasks::TaskScheduler ^ scheduler);
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult> (System.Threading.Tasks.Task<TAntecedentResult>[] tasks, Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler);
member this.ContinueWhenAny : System.Threading.Tasks.Task<'AntecedentResult>[] * Action<System.Threading.Tasks.Task<'AntecedentResult>> * System.Threading.CancellationToken * System.Threading.Tasks.TaskContinuationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.Task

Paramètres de type

TAntecedentResult

Type du résultat du tasks antécédent.The type of the result of the antecedent tasks.

Paramètres

tasks
Task<TAntecedentResult>[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationAction
Action<Task<TAntecedentResult>>

Délégué d'action à exécuter quand une tâche du tableau tasks est terminée.The action delegate to execute when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task.

scheduler
TaskScheduler

TaskScheduler utilisé pour planifier la Task<TResult> de continuation créée.The TaskScheduler that is used to schedule the created continuation Task<TResult>.

Retours

Nouvelle Task de continuation.The new continuation Task.

Exceptions

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- continuationAction a la valeur null.continuationAction is null.

- ou --or- paramref name="scheduler" /> est null.paramref name="scheduler" /> is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le CancellationToken fourni a déjà été supprimé.The provided CancellationToken has already been disposed.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TResult>
 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<TResult> (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(Of TResult) (tasks As Task(), continuationFunction As Func(Of Task, TResult)) As Task(Of TResult)

Paramètres de type

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- continuationFunction est null.continuationFunction is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TResult>
 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<TResult> (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>

Paramètres de type

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

- ou --or- Le CancellationToken fourni a déjà été supprimé.The provided CancellationToken has already been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

ou-or- continuationFunction a la valeur null.continuationFunction is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

- ou --or- Le tableau tasks est vide.The tasks array is empty.

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TResult>
 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<TResult> (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(Of TResult) (tasks As Task(), continuationFunction As Func(Of Task, TResult), continuationOptions As TaskContinuationOptions) As Task(Of TResult)

Paramètres de type

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task<TResult> de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task<TResult>.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

L’un des éléments du tableau tasks a été éliminé.One of the elements in the tasks array has been disposed.

Le tableau tasks a la valeur null.The tasks array is null.

ou-or- continuationFunction est null.continuationFunction is null.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

ou-or- Le tableau tasks est vide.The tasks array is empty.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

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

Crée une Task<TResult> de continuation qui démarrera quand l'une des tâches de l'ensemble fourni se terminera.Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

public:
generic <typename TResult>
 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<TResult> (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>

Paramètres de type

TResult

Type du résultat retourné par le délégué continuationFunction et associé au Task<TResult> créé.The type of the result that is returned by the continuationFunction delegate and associated with the created Task<TResult>.

Paramètres

tasks
Task[]

Tableau de tâches à partir duquel continuer lorsqu'une tâche se termine.The array of tasks from which to continue when one task completes.

continuationFunction
Func<Task,TResult>

Délégué de fonction à exécuter en mode asynchrone quand une tâche du tableau tasks est terminée.The function delegate to execute asynchronously when one task in the tasks array completes.

cancellationToken
CancellationToken

CancellationToken qui sera assigné à la nouvelle tâche de continuation.The CancellationToken that will be assigned to the new continuation task.

continuationOptions
TaskContinuationOptions

Valeur TaskContinuationOptions qui contrôle le comportement de la Task<TResult> de continuation créée.The TaskContinuationOptions value that controls the behavior of the created continuation Task<TResult>.

scheduler
TaskScheduler

TaskScheduler utilisé pour planifier la Task<TResult> de continuation créée.The TaskScheduler that is used to schedule the created continuation Task<TResult>.

Retours

Nouvelle Task<TResult> de continuation.The new continuation Task<TResult>.

Exceptions

Le tableau tasks a la valeur null.The tasks array is null.

- ou --or- continuationFunction a la valeur null.continuationFunction is null.

- ou --or- scheduler a la valeur null.scheduler is null.

Le tableau tasks contient une valeur null.The tasks array contains a null value.

ou-or- Le tableau tasks est vide.The tasks array is empty.

continuationOptions spécifie une valeur de TaskContinuationOptions non valide.continuationOptions specifies an invalid TaskContinuationOptions value.

Le CancellationToken fourni a déjà été supprimé.The provided CancellationToken has already been disposed.

Remarques

Les NotOn @ no__t-0 et OnlyOn @ no__t-1 TaskContinuationOptions, qui contraignent les États TaskStatus qu’une continuation sera exécutée, sont non conformes avec ContinueWhenAny.The NotOn* and OnlyOn* TaskContinuationOptions, which constrain for which TaskStatus states a continuation will be executed, are illegal with ContinueWhenAny.

Voir aussi

S’applique à