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

Definición

Proporciona compatibilidad para crear y programar objetos 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)

Parámetros de tipo

TResult

Valor devuelto de los objetos Task<TResult> creados por los métodos de esta clase.The return value of the Task<TResult> objects that the methods of this class create.

Herencia
TaskFactory<TResult>TaskFactory<TResult>TaskFactory<TResult>TaskFactory<TResult>

Ejemplos

En el ejemplo siguiente se usa estático Factory propiedad para realizar dos llamadas a la TaskFactory<TResult>.StartNew método.The following example uses the static Factory property to make two calls to the TaskFactory<TResult>.StartNew method. La primera tarea devuelve una matriz de cadenas que se rellena con los nombres de archivos en el directorio Mis documentos del usuario, mientras que el segundo devuelve una matriz de cadenas que se rellena con los nombres de los subdirectorios del directorio de Mis documentos del usuario.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. A continuación, llama el TaskFactory.ContinueWhenAll(Task[], Action<Task[]>) método, que muestra información sobre el número de archivos y directorios en las matrices devueltas por las dos tareas una vez que haya completado la ejecución.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

Comentarios

.NET Framework proporciona dos factorías para crear y programar tareas:The .NET Framework provides two factories for creating and scheduling tasks:

La TaskFactory<TResult> clase le permite hacer lo siguiente:The TaskFactory<TResult> class allows you to do the following:

  • Crear una tarea e inícielo inmediatamente mediante una llamada a la StartNew método.Create a task and start it immediately by calling the StartNew method. Puede llamar a las sobrecargas de este método para crear y ejecutar una tarea que requiere argumentos no predeterminados.You can call the overloads of this method to create and execute a task that requires non-default arguments.

    Advertencia

    A partir de la .NET Framework 4.5.NET Framework 4.5, el Task.Run método proporciona la manera más fácil de crear una tarea no tiene valor predeterminado de los valores de configuración y la inicia inmediatamente.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.

  • Crear una tarea que se inicia cuando se ha completado cualquiera de las tareas en una matriz mediante una llamada a la ContinueWhenAny o ContinueWhenAny método.Create a task that starts when any one of the tasks in an array has completed by calling the ContinueWhenAny or ContinueWhenAny method.

  • Crear una tarea que se inicia cuando se hayan completado todas las tareas en una matriz mediante una llamada a la ContinueWhenAll o ContinueWhenAll método.Create a task that starts when all the tasks in an array have completed by calling the ContinueWhenAll or ContinueWhenAll method.

Estático Task<TResult>.Factory propiedad devuelve el valor predeterminado es TaskFactory<TResult> objeto.The static Task<TResult>.Factory property returns a default TaskFactory<TResult> object. También puede llamar a uno de los TaskFactory<TResult> clase constructores para configurar el Task<TResult> objetos que el TaskFactory<TResult> crea la clase.You can also call one of the TaskFactory<TResult> class constructors to configure the Task<TResult> objects that the TaskFactory<TResult> class creates. En el ejemplo siguiente se configura un nuevo TaskFactory<TResult> objeto para crear tareas que tienen un token de cancelación indicado, opciones de creación de tareas, las opciones de continuación y un programador de tareas personalizado.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

En la mayoría de los casos, no es necesario crear una nueva instancia TaskFactory<TResult> instancia.In most cases, you do not have to instantiate a new TaskFactory<TResult> instance. En su lugar, puede usar estático Task<TResult>.Factory propiedad, que devuelve un objeto de fábrica que utiliza valores predeterminados.Instead, you can use the static Task<TResult>.Factory property, which returns a factory object that uses default values. A continuación, puede llamar a sus métodos para iniciar nuevas tareas o definir las continuaciones de tareas.You can then call its methods to start new tasks or define task continuations. Para obtener un ejemplo, vea el ejemplo.For an illustration, see the example.

Constructores

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

Inicializa una instancia de TaskFactory<TResult> con la configuración predeterminada.Initializes a TaskFactory<TResult> instance with the default configuration.

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

Inicializa una instancia de TaskFactory<TResult> con la configuración predeterminada.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)

Inicializa una instancia de TaskFactory<TResult> con la configuración especificada.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)

Inicializa una instancia de TaskFactory<TResult> con la configuración especificada.Initializes a TaskFactory<TResult> instance with the specified configuration.

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

Inicializa una instancia de TaskFactory<TResult> con la configuración especificada.Initializes a TaskFactory<TResult> instance with the specified configuration.

Propiedades

CancellationToken CancellationToken CancellationToken CancellationToken

Obtiene el token de cancelación predeterminado para este generador de tareas.Gets the default cancellation token for this task factory.

ContinuationOptions ContinuationOptions ContinuationOptions ContinuationOptions

Obtiene el valor de enumeración TaskContinuationOptions para este generador de tareas.Gets the TaskContinuationOptions enumeration value for this task factory.

CreationOptions CreationOptions CreationOptions CreationOptions

Obtiene el valor de enumeración TaskCreationOptions para este generador de tareas.Gets the TaskCreationOptions enumeration value for this task factory.

Scheduler Scheduler Scheduler Scheduler

Obtiene el programador de tareas para este generador de tareas.Gets the task scheduler for this task factory.

Métodos

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

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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>)

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete el conjunto de tareas proporcionado.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>)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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>)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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)

Crea una tarea de continuación que se iniciará cuando se complete cualquier tarea del conjunto proporcionado.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)

Determina si el objeto especificado es igual al objeto actual.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.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>)

Crea una tarea que ejecuta una función del método End cuando se completa la interfaz IAsyncResult especificada.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)

Crea una tarea que ejecuta una función del método End cuando se completa la interfaz IAsyncResult especificada.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)

Crea una tarea que ejecuta una función del método End cuando se completa la interfaz IAsyncResult especificada.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.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)

Crea una tarea que representa un par de métodos Begin y End que se ajustan al modelo de programación asincrónica.Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Sirve como la función hash predeterminada.Serves as the default hash function.

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

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

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

Crea una copia superficial del objeto Object actual.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)

Crea e inicia una tarea.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)

Crea e inicia una tarea.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)

Crea e inicia una tarea.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)

Crea e inicia una tarea.Creates and starts a task.

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

Crea e inicia una tarea.Creates and starts a task.

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

Crea e inicia una tarea.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)

Crea e inicia una tarea.Creates and starts a task.

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

Crea e inicia una tarea.Creates and starts a task.

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

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a

Seguridad para subprocesos

Todos los miembros públicos y protegidos de TaskFactory<TResult> son seguros para subprocesos y se pueden usar simultáneamente desde varios subprocesos.All public and protected members of TaskFactory<TResult> are thread-safe and may be used concurrently from multiple threads.

Consulte también: