TaskFactory TaskFactory TaskFactory TaskFactory Class

定义

提供对创建和计划 Task 对象的支持。Provides support for creating and scheduling Task objects.

public ref class TaskFactory
public class TaskFactory
type TaskFactory = class
Public Class TaskFactory
继承
TaskFactoryTaskFactoryTaskFactoryTaskFactory

示例

下面的示例使用静态Factory属性以使两个调用TaskFactory.StartNew方法。The following example uses the static Factory property to make two calls to the TaskFactory.StartNew method. 第一个使用填充的用户的 MyDocuments 目录中的文件名称的数组,而第二个使用填充的用户的 MyDocuments 目录的子目录的名称的数组。The first populates an array with the names of files in the user's MyDocuments directory, while the second populates an array with the names of subdirectories of the user's MyDocuments directory. 然后,它调用TaskFactory.ContinueWhenAll(Task[], Action<Task[]>)方法前, 两个任务都完成执行后两个数组中显示的数量的文件和目录的信息。It then calls the TaskFactory.ContinueWhenAll(Task[], Action<Task[]>) method, which displays information about the number of files and directories in the two arrays after the first two tasks have completed execution.

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

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

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

      Task.Factory.ContinueWhenAll(tasks, completedTasks => {
                                             Console.WriteLine("{0} contains: ", docsDirectory);
                                             Console.WriteLine("   {0} subdirectories", dirs.Length);
                                             Console.WriteLine("   {0} files", files.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
      Dim files() As String = Nothing
      Dim dirs() As String = Nothing
      Dim docsDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
      
      tasks(0) = Task.Factory.StartNew( Sub()
                                           files = Directory.GetFiles(docsDirectory)
                                        End Sub )
      tasks(1) = Task.Factory.StartNew( Sub()
                                           dirs = Directory.GetDirectories(docsDirectory)
                                        End Sub )
      Task.Factory.ContinueWhenAll(tasks, Sub(completedTasks)
                                             Console.WriteLine("{0} contains: ", docsDirectory)
                                             Console.WriteLine("   {0} subdirectories", dirs.Length)
                                             Console.WriteLine("   {0} files", files.Length)
                                          End Sub)
   End Sub
End Module
' The example displays output like the following:
'       C:\Users\<username>\Documents contains:
'          24 subdirectories
'          16 files

注解

.NET Framework 提供了两个工厂用于创建和计划任务:The .NET Framework provides two factories for creating and scheduling tasks:

  • TaskFactory类,该类创建TaskTask<TResult>对象。The TaskFactory class, which creates Task and Task<TResult> objects. 您可以调用此方法创建和执行的任务需要非默认自变量的重载。You can call the overloads of this method to create and execute a task that requires non-default arguments.

    警告

    从开始.NET Framework 4.5.NET Framework 4.5,则Task.Run方法提供了使用默认配置值创建一个任务并立即开始的最简单方法。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.

  • TaskFactory<TResult>类,该类创建Task<TResult>对象。The TaskFactory<TResult> class, which creates Task<TResult> objects.

TaskFactory类使您可以执行以下操作:The TaskFactory class allows you to do the following:

  • 创建任务并通过调用立即启动StartNew方法。Create a task and start it immediately by calling the StartNew method.

    警告

    从开始.NET Framework 4.5.NET Framework 4.5,则Task.Run方法提供了使用默认配置值创建一个任务并立即开始的最简单方法。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.

  • 创建任务时通过调用已完成一个数组中的任务之一启动ContinueWhenAny方法。Create a task that starts when any one of the tasks in an array has completed by calling the ContinueWhenAny method.

  • 创建任务时数组中的所有任务都完成通过调用启动ContinueWhenAll方法。Create a task that starts when all the tasks in an array have completed by calling the ContinueWhenAll method.

静态Task<TResult>.Factory属性返回的默认TaskFactory<TResult>对象。The static Task<TResult>.Factory property returns a default TaskFactory<TResult> object. 您还可以调用之一TaskFactory类构造函数来配置Task对象的TaskFactory类创建。You can also call one of the TaskFactory class constructors to configure the Task objects that the TaskFactory class creates. 下面的示例配置一个新TaskFactory对象来创建具有指定的取消标记、 任务创建选项、 延续选项和自定义的任务计划程序的任务。The following example configures a new TaskFactory 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;

class Example
{
   static CancellationTokenSource cts = new CancellationTokenSource();
   
   static TaskFactory factory = new TaskFactory(
      cts.Token,
      TaskCreationOptions.PreferFairness,
      TaskContinuationOptions.ExecuteSynchronously,
      new CustomScheduler());

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

   static void DoWork() {/*...*/ }
}
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(cts.Token,
                                     TaskCreationOptions.PreferFairness,
                                     TaskContinuationOptions.ExecuteSynchronously,
                                     New CustomScheduler())

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

   Sub DoWork()
      ' ...
   End Sub
End Module

在大多数情况下,您不需要实例化一个新TaskFactory实例。In most cases, you do not have to instantiate a new TaskFactory instance. 相反,可以使用Task.Factory属性,它返回一个工厂对象,将使用默认值。Instead, you can use the Task.Factory property, which returns a factory object that uses default values. 然后可以调用其方法来启动新任务或定义任务延续。You can then call its methods to start new tasks or define task continuations. 有关说明,请参阅示例。For an illustration, see the example.

构造函数

TaskFactory() TaskFactory() TaskFactory() TaskFactory()

使用默认配置初始化 TaskFactory 实例。Initializes a TaskFactory instance with the default configuration.

TaskFactory(CancellationToken) TaskFactory(CancellationToken) TaskFactory(CancellationToken) TaskFactory(CancellationToken)

使用指定配置初始化 TaskFactory 实例。Initializes a TaskFactory instance with the specified configuration.

TaskFactory(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler) TaskFactory(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler) TaskFactory(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler) TaskFactory(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler)

使用指定配置初始化 TaskFactory 实例。Initializes a TaskFactory instance with the specified configuration.

TaskFactory(TaskCreationOptions, TaskContinuationOptions) TaskFactory(TaskCreationOptions, TaskContinuationOptions) TaskFactory(TaskCreationOptions, TaskContinuationOptions) TaskFactory(TaskCreationOptions, TaskContinuationOptions)

使用指定配置初始化 TaskFactory 实例。Initializes a TaskFactory instance with the specified configuration.

TaskFactory(TaskScheduler) TaskFactory(TaskScheduler) TaskFactory(TaskScheduler) TaskFactory(TaskScheduler)

使用指定配置初始化 TaskFactory 实例。Initializes a TaskFactory instance with the specified configuration.

属性

CancellationToken CancellationToken CancellationToken CancellationToken

获取此任务工厂的默认取消标记。Gets the default cancellation token for this task factory.

ContinuationOptions ContinuationOptions ContinuationOptions ContinuationOptions

获取此任务工厂的默认任务继续选项。Gets the default task continuation options for this task factory.

CreationOptions CreationOptions CreationOptions CreationOptions

获取此任务工厂的默认任务创建选项。Gets the default task creation options for this task factory.

Scheduler Scheduler Scheduler Scheduler

获取此任务工厂的默认任务计划程序。Gets the default task scheduler for this task factory.

方法

ContinueWhenAll(Task[], Action<Task[]>) ContinueWhenAll(Task[], Action<Task[]>) ContinueWhenAll(Task[], Action<Task[]>) ContinueWhenAll(Task[], Action<Task[]>)

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续任务,该任务在一组指定的任务完成后开始。Creates a continuation task that starts when a set of specified tasks has completed.

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

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny(Task[], Action<Task>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny(Task[], Action<Task>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny(Task[], Action<Task>, CancellationToken, TaskContinuationOptions, TaskScheduler)

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。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>) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>)

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken)

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。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>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult,TResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>,TResult>, TaskContinuationOptions)

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。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>>) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>)

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken)

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, CancellationToken, TaskContinuationOptions, TaskScheduler)

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, TaskContinuationOptions) ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Action<Task<TAntecedentResult>>, TaskContinuationOptions)

创建一个延续 Task,它将在提供的组中的任何任务完成后马上开始。Creates a continuation Task that will be started upon the completion of any Task in the provided set.

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

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, CancellationToken) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, CancellationToken) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, CancellationToken)

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler)

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。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) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, TaskContinuationOptions) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, TaskContinuationOptions) ContinueWhenAny<TResult>(Task[], Func<Task,TResult>, TaskContinuationOptions)

创建一个延续 Task<TResult>,它将在提供的组中的任何任务完成后马上开始。Creates a continuation Task<TResult> that will be started upon the completion of any Task in the provided set.

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

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

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

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。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>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions) FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions)

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>) FromAsync(IAsyncResult, Action<IAsyncResult>)

创建一个 Task,它在指定的 IAsyncResult 完成时执行一个结束方法操作。Creates a Task that executes an end method action when a specified IAsyncResult completes.

FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions)

创建一个 Task,它在指定的 IAsyncResult 完成时执行一个结束方法操作。Creates a Task that executes an end method action when a specified IAsyncResult completes.

FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler) FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions, TaskScheduler)

创建一个 Task,它在指定的 IAsyncResult 完成时执行一个结束方法操作。Creates a Task that executes an end method action when a specified IAsyncResult completes.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> 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>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object)

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。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>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) FromAsync<TArg1,TArg2,TArg3>(Func<TArg1,TArg2,TArg3,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions)

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> 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>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object)

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。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>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions) FromAsync<TArg1,TArg2>(Func<TArg1,TArg2,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, TArg2, Object, TaskCreationOptions)

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。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>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions) FromAsync<TArg1>(Func<TArg1,AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, TArg1, Object, TaskCreationOptions)

创建一个 Task,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它表示符合异步编程模型模式的成对的开始和结束方法。Creates a Task<TResult> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

创建一个 Task<TResult>,它在指定的 IAsyncResult 完成时执行一个结束方法函数。Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

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

创建一个 Task<TResult>,它在指定的 IAsyncResult 完成时执行一个结束方法函数。Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

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

创建一个 Task<TResult>,它在指定的 IAsyncResult 完成时执行一个结束方法函数。Creates a Task<TResult> that executes an end method function when a specified IAsyncResult completes.

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

作为默认哈希函数。Serves as the default hash function.

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

获取当前实例的 TypeGets the Type of the current instance.

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

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
StartNew(Action) StartNew(Action) StartNew(Action) StartNew(Action)

创建并启动 任务。Creates and starts a task.

StartNew(Action, CancellationToken) StartNew(Action, CancellationToken) StartNew(Action, CancellationToken) StartNew(Action, CancellationToken)

创建并启动 TaskCreates and starts a Task.

StartNew(Action, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Action, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Action, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Action, CancellationToken, TaskCreationOptions, TaskScheduler)

创建并启动 TaskCreates and starts a Task.

StartNew(Action, TaskCreationOptions) StartNew(Action, TaskCreationOptions) StartNew(Action, TaskCreationOptions) StartNew(Action, TaskCreationOptions)

创建并启动 TaskCreates and starts a Task.

StartNew(Action<Object>, Object) StartNew(Action<Object>, Object) StartNew(Action<Object>, Object) StartNew(Action<Object>, Object)

创建并启动 TaskCreates and starts a Task.

StartNew(Action<Object>, Object, CancellationToken) StartNew(Action<Object>, Object, CancellationToken) StartNew(Action<Object>, Object, CancellationToken) StartNew(Action<Object>, Object, CancellationToken)

创建并启动 TaskCreates and starts a Task.

StartNew(Action<Object>, Object, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Action<Object>, Object, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Action<Object>, Object, CancellationToken, TaskCreationOptions, TaskScheduler) StartNew(Action<Object>, Object, CancellationToken, TaskCreationOptions, TaskScheduler)

创建并启动 TaskCreates and starts a Task.

StartNew(Action<Object>, Object, TaskCreationOptions) StartNew(Action<Object>, Object, TaskCreationOptions) StartNew(Action<Object>, Object, TaskCreationOptions) StartNew(Action<Object>, Object, TaskCreationOptions)

创建并启动 TaskCreates and starts a Task.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

创建并启动 Task<TResult>Creates and starts a Task<TResult>.

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

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于

线程安全性

所有公共和受保护成员TaskFactory是线程安全的可能从多个线程同时使用。All public and protected members of TaskFactory are thread-safe and may be used concurrently from multiple threads.

另请参阅