TaskFactory<TResult> TaskFactory<TResult> TaskFactory<TResult> TaskFactory<TResult> Class

Définition

Prend en charge la création et la planification d'objets Task<TResult>.Provides support for creating and scheduling Task<TResult> objects.

generic <typename TResult>
public ref class TaskFactory
public class TaskFactory<TResult>
type TaskFactory<'Result> = class
Public Class TaskFactory(Of TResult)

Paramètres de type

TResult

Valeur de renvoi des objets Task<TResult> que créent les méthodes de cette classe.The return value of the Task<TResult> objects that the methods of this class create.

Héritage
TaskFactory<TResult>TaskFactory<TResult>TaskFactory<TResult>TaskFactory<TResult>

Exemples

L’exemple suivant utilise la méthode statique Factory propriété afin que les deux appels à la TaskFactory<TResult>.StartNew (méthode).The following example uses the static Factory property to make two calls to the TaskFactory<TResult>.StartNew method. La première tâche retourne un tableau de chaînes qui est rempli avec les noms des fichiers dans le répertoire Mes documents, alors que la seconde retourne un tableau de chaînes qui est rempli avec les noms des sous-répertoires du répertoire Mes documents de l’utilisateur.The first task returns a string array that is populated with the names of files in the user's MyDocuments directory, while the second returns a string array that is populated with the names of subdirectories of the user's MyDocuments directory. Il appelle ensuite la TaskFactory.ContinueWhenAll(Task[], Action<Task[]>) (méthode), qui affiche des informations sur le nombre de fichiers et répertoires dans les tableaux retournés par les deux tâches une fois qu’ils aient terminé leur exécution.It then calls the TaskFactory.ContinueWhenAll(Task[], Action<Task[]>) method, which displays information about the number of files and directories in the arrays returned by the two tasks after they have completed execution.

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

public class Example
{
   public static void Main()
   {
      Task<string[]>[] tasks = new Task<string[]>[2];
      String docsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

      tasks[0] = Task<string[]>.Factory.StartNew( () => Directory.GetFiles(docsDirectory));
      tasks[1] = Task<string[]>.Factory.StartNew( () => Directory.GetDirectories(docsDirectory));

      Task.Factory.ContinueWhenAll(tasks, completedTasks => {
                                             Console.WriteLine("{0} contains: ", docsDirectory);
                                             Console.WriteLine("   {0} subdirectories", tasks[1].Result.Length);
                                             Console.WriteLine("   {0} files", tasks[0].Result.Length);
                                          } );
   }
}
// The example displays output like the following:
//       C:\Users\<username>\Documents contains:
//          24 subdirectories
//          16 files
Imports System.IO
Imports System.Threading.Tasks

Module Example
   Public Sub Main()
      Dim tasks(1) As Task(Of String())
      Dim docsDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
      
      tasks(0) = Task(Of String()).Factory.StartNew( Function()Directory.GetFiles(docsDirectory) )
''                                        End Sub )
      tasks(1) = Task(Of String()).Factory.StartNew( Function() Directory.GetDirectories(docsDirectory) )
''                                        End Sub )
      Task.Factory.ContinueWhenAll(tasks, Sub(completedTasks)
                                             Console.WriteLine("{0} contains: ", docsDirectory)
                                             Console.WriteLine("   {0} subdirectories", tasks(1).Result.Length)
                                             Console.WriteLine("   {0} files", tasks(0).Result.Length)
                                          End Sub)
   End Sub
End Module
' The example displays output like the following:
'       C:\Users\<username>\Documents contains:
'          24 subdirectories
'          16 files

Remarques

Le .NET Framework fournit deux fabriques pour la création et la planification des tâches :The .NET Framework provides two factories for creating and scheduling tasks:

Le TaskFactory<TResult> classe permet d’effectuer les opérations suivantes :The TaskFactory<TResult> class allows you to do the following:

  • Créer une tâche et démarrer immédiatement en appelant le StartNew (méthode).Create a task and start it immediately by calling the StartNew method. Vous pouvez appeler des surcharges de cette méthode pour créer et exécuter une tâche qui nécessite des arguments personnalisés.You can call the overloads of this method to create and execute a task that requires non-default arguments.

    Avertissement

    En commençant par le .NET Framework 4.5.NET Framework 4.5, le Task.Run méthode fournit le moyen le plus simple pour créer une tâche avec la valeur par défaut des valeurs de configuration et la démarrer immédiatement.Starting with the .NET Framework 4.5.NET Framework 4.5, the Task.Run method provides the easiest way to create a task with default configuration values and start it immediately.

  • Créer une tâche qui démarre lorsque l’une des tâches dans un tableau est terminée en appelant le ContinueWhenAny ou ContinueWhenAny (méthode).Create a task that starts when any one of the tasks in an array has completed by calling the ContinueWhenAny or ContinueWhenAny method.

  • Créer une tâche qui démarre lorsque toutes les tâches dans un tableau s’est terminé en appelant le ContinueWhenAll ou ContinueWhenAll (méthode).Create a task that starts when all the tasks in an array have completed by calling the ContinueWhenAll or ContinueWhenAll method.

La méthode statique Task<TResult>.Factory propriété retourne une valeur par défaut TaskFactory<TResult> objet.The static Task<TResult>.Factory property returns a default TaskFactory<TResult> object. Vous pouvez également appeler une de la TaskFactory<TResult> classe constructeurs pour configurer le Task<TResult> objets qui la TaskFactory<TResult> classe crée.You can also call one of the TaskFactory<TResult> class constructors to configure the Task<TResult> objects that the TaskFactory<TResult> class creates. L’exemple suivant configure un nouveau TaskFactory<TResult> objet pour créer des tâches qui ont un jeton d’annulation spécifié, les options de création de tâche, les options de continuation et un planificateur de tâches personnalisé.The following example configures a new TaskFactory<TResult> object to create tasks that have a specified cancellation token, task creation options, continuation options, and a customized task scheduler.

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

public class Example
{
   static CancellationTokenSource cts = new CancellationTokenSource();

   static TaskFactory<int> factory = new TaskFactory<int>(
      cts.Token,
      TaskCreationOptions.PreferFairness,
      TaskContinuationOptions.ExecuteSynchronously,
      new CustomScheduler());

   static void Main()
   {
      var t2 = factory.StartNew(() => DoWork());
      cts.Dispose();
   }

   static int DoWork()
   {
       /*...*/
       return DateTime.Now.Hour <= 12 ?  1 : 2;
    }
}
Imports System.Collections.Generic
Imports System.Threading
Imports System.Threading.Tasks

Module Example
   Public Sub Main()
      Dim cts As New CancellationTokenSource()
      Dim factory As New TaskFactory(Of Integer)(
                         cts.Token,
                         TaskCreationOptions.PreferFairness,
                         TaskContinuationOptions.ExecuteSynchronously,
                         New CustomScheduler())

      Dim t2 = factory.StartNew(Function() DoWork())
      cts.Dispose()
   End Sub

   Function DoWork() As Integer
      Return If(Date.Now.Hour <= 12, 1, 2)
   End Function
End Module

Dans la plupart des cas, vous n’avez pas instancier un nouvel TaskFactory<TResult> instance.In most cases, you do not have to instantiate a new TaskFactory<TResult> instance. Au lieu de cela, vous pouvez utiliser la méthode statique Task<TResult>.Factory propriété, qui retourne un objet de fabrique qui utilise les valeurs par défaut.Instead, you can use the static Task<TResult>.Factory property, which returns a factory object that uses default values. Vous pouvez ensuite appeler ses méthodes pour démarrer de nouvelles tâches ou définir les continuations de tâches.You can then call its methods to start new tasks or define task continuations. Pour obtenir une illustration, consultez l’exemple.For an illustration, see the example.

Constructeurs

TaskFactory<TResult>() TaskFactory<TResult>() TaskFactory<TResult>() TaskFactory<TResult>()

Initialise une instance de TaskFactory<TResult> avec la configuration par défaut.Initializes a TaskFactory<TResult> instance with the default configuration.

TaskFactory<TResult>(CancellationToken) TaskFactory<TResult>(CancellationToken) TaskFactory<TResult>(CancellationToken) TaskFactory<TResult>(CancellationToken)

Initialise une instance de TaskFactory<TResult> avec la configuration par défaut.Initializes a TaskFactory<TResult> instance with the default configuration.

TaskFactory<TResult>(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler) TaskFactory<TResult>(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler) TaskFactory<TResult>(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler) TaskFactory<TResult>(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler)

Initialise une instance de TaskFactory<TResult> avec la configuration spécifiée.Initializes a TaskFactory<TResult> instance with the specified configuration.

TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions) TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions) TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions) TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions)

Initialise une instance de TaskFactory<TResult> avec la configuration spécifiée.Initializes a TaskFactory<TResult> instance with the specified configuration.

TaskFactory<TResult>(TaskScheduler) TaskFactory<TResult>(TaskScheduler) TaskFactory<TResult>(TaskScheduler) TaskFactory<TResult>(TaskScheduler)

Initialise une instance de TaskFactory<TResult> avec la configuration spécifiée.Initializes a TaskFactory<TResult> instance with the specified configuration.

Propriétés

CancellationToken CancellationToken CancellationToken CancellationToken

Obtient le jeton d’annulation par défaut pour cette fabrique de tâches.Gets the default cancellation token for this task factory.

ContinuationOptions ContinuationOptions ContinuationOptions ContinuationOptions

Obtient la valeur d'énumération TaskContinuationOptions de cette fabrique de tâches.Gets the TaskContinuationOptions enumeration value for this task factory.

CreationOptions CreationOptions CreationOptions CreationOptions

Obtient la valeur d'énumération TaskCreationOptions de cette fabrique de tâches.Gets the TaskCreationOptions enumeration value for this task factory.

Scheduler Scheduler Scheduler Scheduler

Retourne le planificateur de tâches pour cette fabrique.Gets the task scheduler for this task factory.

Méthodes

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

Crée une tâche de continuation qui démarrera lorsqu’un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided tasks.

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

Crée une tâche de continuation qui démarrera lorsqu’un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided tasks.

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

Crée une tâche de continuation qui démarrera lorsqu'un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided Tasks.

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

Crée une tâche de continuation qui démarrera lorsqu'un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided Tasks.

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

Crée une tâche de continuation qui démarrera lorsqu’un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided tasks.

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

Crée une tâche de continuation qui démarrera lorsqu’un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided tasks.

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

Crée une tâche de continuation qui démarrera lorsqu’un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided tasks.

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

Crée une tâche de continuation qui démarrera lorsqu’un ensemble de tâches fournies se terminera.Creates a continuation task that will be started upon the completion of a set of provided tasks.

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

Crée une tâche de continuation qui démarrera lorsque 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[], Func<Task,TResult>, CancellationToken) ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken) ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken) ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken)

Crée une tâche de continuation qui démarrera lorsque 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[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

Crée une tâche de continuation qui démarrera lorsque 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[], Func<Task,TResult>, TaskContinuationOptions) ContinueWhenAny(Task[], Func<Task,TResult>, TaskContinuationOptions) ContinueWhenAny(Task[], Func<Task,TResult>, TaskContinuationOptions) ContinueWhenAny(Task[], Func<Task,TResult>, TaskContinuationOptions)

Crée une tâche de continuation qui démarrera lorsque 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>[], Func<Task<TAntecedentResult>,TResult>) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>)

Crée une tâche de continuation qui démarrera lorsque 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>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken)

Crée une tâche de continuation qui démarrera lorsque 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>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

Crée une tâche de continuation qui démarrera lorsque 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>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions)

Crée une tâche de continuation qui démarrera lorsque 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.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Détermine si l'objet spécifié est identique à l'objet actuel.Determines whether the specified object is equal to the current object.

(Inherited from Object)
FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, Object, TaskCreationOptions)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>)

Crée une tâche qui exécute une fonction de méthode End lorsqu'un IAsyncResult spécifié se termine.Creates a task that executes an end method function when a specified IAsyncResult completes.

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions)

Crée une tâche qui exécute une fonction de méthode End lorsqu'un IAsyncResult spécifié se termine.Creates a task that executes an end method function when a specified IAsyncResult completes.

FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Func<IAsyncResult,TResult>, TaskCreationOptions, TaskScheduler)

Crée une tâche qui exécute une fonction de méthode End lorsqu'un IAsyncResult spécifié se termine.Creates a task that executes an end method function when a specified IAsyncResult completes.

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, TArg2, Object, TaskCreationOptions)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Func<IAsyncResult,TResult>, TArg1, Object, TaskCreationOptions)

Crée une tâche qui représente une paire de méthodes Begin et End conformes au modèle de programmation asynchrone.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Fait office de fonction de hachage par défaut.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtient le Type de l'instance actuelle.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crée une copie superficielle de l'objet Object actuel.Creates a shallow copy of the current Object.

(Inherited from Object)
StartNew(Func<Object,TResult>, Object) StartNew(Func<Object,TResult>, Object) StartNew(Func<Object,TResult>, Object) StartNew(Func<Object,TResult>, Object)

Crée et lance une tâche.Creates and starts a task.

StartNew(Func<Object,TResult>, Object, CancellationToken) StartNew(Func<Object,TResult>, Object, CancellationToken) StartNew(Func<Object,TResult>, Object, CancellationToken) StartNew(Func<Object,TResult>, Object, CancellationToken)

Crée et lance une tâche.Creates and starts a task.

StartNew(Func<Object,TResult>, Object, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Func<Object,TResult>, Object, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Func<Object,TResult>, Object, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Func<Object,TResult>, Object, CancellationToken, TaskCreationOptions, TaskScheduler)

Crée et lance une tâche.Creates and starts a task.

StartNew(Func<Object,TResult>, Object, TaskCreationOptions) StartNew(Func<Object,TResult>, Object, TaskCreationOptions) StartNew(Func<Object,TResult>, Object, TaskCreationOptions) StartNew(Func<Object,TResult>, Object, TaskCreationOptions)

Crée et lance une tâche.Creates and starts a task.

StartNew(Func<TResult>) StartNew(Func<TResult>) StartNew(Func<TResult>) StartNew(Func<TResult>)

Crée et lance une tâche.Creates and starts a task.

StartNew(Func<TResult>, CancellationToken) StartNew(Func<TResult>, CancellationToken) StartNew(Func<TResult>, CancellationToken) StartNew(Func<TResult>, CancellationToken)

Crée et lance une tâche.Creates and starts a task.

StartNew(Func<TResult>, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Func<TResult>, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Func<TResult>, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Func<TResult>, CancellationToken, TaskCreationOptions, TaskScheduler)

Crée et lance une tâche.Creates and starts a task.

StartNew(Func<TResult>, TaskCreationOptions) StartNew(Func<TResult>, TaskCreationOptions) StartNew(Func<TResult>, TaskCreationOptions) StartNew(Func<TResult>, TaskCreationOptions)

Crée et lance une tâche.Creates and starts a task.

ToString() ToString() ToString() ToString()

Retourne une chaîne qui représente l'objet actuel.Returns a string that represents the current object.

(Inherited from Object)

S’applique à

Cohérence de thread

Tous les membres publics et protégés de TaskFactory<TResult> sont thread-safe et peuvent être utilisés simultanément par plusieurs threads.All public and protected members of TaskFactory<TResult> are thread-safe and may be used concurrently from multiple threads.

Voir aussi