TaskFactory<TResult> 建構函式

定義

初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance.

多載

TaskFactory<TResult>()

使用預設組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the default configuration.

TaskFactory<TResult>(CancellationToken)

使用預設組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the default configuration.

TaskFactory<TResult>(TaskScheduler)

使用指定的組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the specified configuration.

TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions)

使用指定的組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the specified configuration.

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

使用指定的組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the specified configuration.

TaskFactory<TResult>()

使用預設組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the default configuration.

public:
 TaskFactory();
public TaskFactory ();
Public Sub New ()

備註

此函式會建立具有預設設定的 TaskFactory<TResult> 實例。This constructor creates a TaskFactory<TResult> instance with a default configuration. TaskCreationOptions 屬性會初始化為 NoneTaskContinuationOptions 屬性會初始化為 None,而 TaskScheduler 屬性會初始化為目前的排程器(請參閱 Current)。The TaskCreationOptions property is initialized to None, the TaskContinuationOptions property is initialized to None, and the TaskScheduler property is initialized to the current scheduler (see Current).

另請參閱

TaskFactory<TResult>(CancellationToken)

使用預設組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the default configuration.

public:
 TaskFactory(System::Threading::CancellationToken cancellationToken);
public TaskFactory (System.Threading.CancellationToken cancellationToken);
new System.Threading.Tasks.TaskFactory<'Result> : System.Threading.CancellationToken -> System.Threading.Tasks.TaskFactory<'Result>

參數

cancellationToken
CancellationToken

除非呼叫處理站方法時明確指定另一個取消語彙基元,否則為將指派給這個 TaskFactory 所建立之工作的預設取消語彙基元。The default cancellation token that will be assigned to tasks created by this TaskFactory unless another cancellation token is explicitly specified when calling the factory methods.

備註

此函式會建立具有預設設定的 TaskFactory<TResult> 實例。This constructor creates a TaskFactory<TResult> instance with a default configuration. TaskCreationOptions 屬性會初始化為 NoneTaskContinuationOptions 屬性會初始化為 None,而 TaskScheduler 屬性會初始化為目前的排程器(請參閱 Current)。The TaskCreationOptions property is initialized to None, the TaskContinuationOptions property is initialized to None, and the TaskScheduler property is initialized to the current scheduler (see Current).

另請參閱

TaskFactory<TResult>(TaskScheduler)

使用指定的組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the specified configuration.

public:
 TaskFactory(System::Threading::Tasks::TaskScheduler ^ scheduler);
public TaskFactory (System.Threading.Tasks.TaskScheduler scheduler);
new System.Threading.Tasks.TaskFactory<'Result> : System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.TaskFactory<'Result>
Public Sub New (scheduler As TaskScheduler)

參數

scheduler
TaskScheduler

排程器,用來排定任何使用這個 TaskFactory<TResult> 所建立的工作。The scheduler to use to schedule any tasks created with this TaskFactory<TResult>. null 值表示應該使用目前的 TaskSchedulerA null value indicates that the current TaskScheduler should be used.

備註

使用這個函式時,TaskCreationOptions 屬性會初始化為 NoneTaskContinuationOptions 屬性會初始化為 None,而 TaskScheduler 屬性會初始化為 scheduler,除非它是 null,在此情況下,屬性會初始化為目前的排程器(請參閱 Current)。With this constructor, the TaskCreationOptions property is initialized to None, the TaskContinuationOptions property is initialized to None, and the TaskScheduler property is initialized to scheduler, unless it's null, in which case the property is initialized to the current scheduler (see Current).

另請參閱

TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions)

使用指定的組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the specified configuration.

public:
 TaskFactory(System::Threading::Tasks::TaskCreationOptions creationOptions, System::Threading::Tasks::TaskContinuationOptions continuationOptions);
public TaskFactory (System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions);
new System.Threading.Tasks.TaskFactory<'Result> : System.Threading.Tasks.TaskCreationOptions * System.Threading.Tasks.TaskContinuationOptions -> System.Threading.Tasks.TaskFactory<'Result>
Public Sub New (creationOptions As TaskCreationOptions, continuationOptions As TaskContinuationOptions)

參數

creationOptions
TaskCreationOptions

使用這個 TaskFactory<TResult> 建立工作時要採用的預設選項。The default options to use when creating tasks with this TaskFactory<TResult>.

continuationOptions
TaskContinuationOptions

使用這個 TaskFactory<TResult> 建立接續工作時要採用的預設選項。The default options to use when creating continuation tasks with this TaskFactory<TResult>.

例外狀況

creationOptionscontinuationOptions 指定了無效值。creationOptions or continuationOptions specifies an invalid value.

備註

使用這個函式時,TaskCreationOptions 屬性會初始化為 creationOptionsTaskContinuationOptions 屬性會初始化為 continuationOptions,而 TaskScheduler 屬性會初始化為目前的排程器(請參閱 Current)。With this constructor, the TaskCreationOptions property is initialized to creationOptions, the TaskContinuationOptions property is initialized to continuationOptions, and the TaskScheduler property is initialized to the current scheduler (see Current).

另請參閱

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

使用指定的組態,初始化 TaskFactory<TResult> 執行個體。Initializes a TaskFactory<TResult> instance with the specified configuration.

public:
 TaskFactory(System::Threading::CancellationToken cancellationToken, System::Threading::Tasks::TaskCreationOptions creationOptions, System::Threading::Tasks::TaskContinuationOptions continuationOptions, System::Threading::Tasks::TaskScheduler ^ scheduler);
public TaskFactory (System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler);
new System.Threading.Tasks.TaskFactory<'Result> : System.Threading.CancellationToken * System.Threading.Tasks.TaskCreationOptions * System.Threading.Tasks.TaskContinuationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.TaskFactory<'Result>

參數

cancellationToken
CancellationToken

除非呼叫處理站方法時明確指定另一個取消語彙基元,否則為將指派給這個 TaskFactory 所建立之工作的預設取消語彙基元。The default cancellation token that will be assigned to tasks created by this TaskFactory unless another cancellation token is explicitly specified when calling the factory methods.

creationOptions
TaskCreationOptions

使用這個 TaskFactory<TResult> 建立工作時要採用的預設選項。The default options to use when creating tasks with this TaskFactory<TResult>.

continuationOptions
TaskContinuationOptions

使用這個 TaskFactory<TResult> 建立接續工作時要採用的預設選項。The default options to use when creating continuation tasks with this TaskFactory<TResult>.

scheduler
TaskScheduler

預設排程器,用來排定任何使用這個 TaskFactory<TResult> 所建立的工作。The default scheduler to use to schedule any tasks created with this TaskFactory<TResult>. null 值表示應該使用 CurrentA null value indicates that Current should be used.

例外狀況

creationOptionscontinuationOptions 指定了無效值。creationOptions or continuationOptions specifies an invalid value.

備註

使用這個函式時,TaskCreationOptions 屬性會初始化為 creationOptionsTaskContinuationOptions 屬性會初始化為 continuationOptions,而 TaskScheduler 屬性會初始化為 scheduler,除非它是 null,在此情況下,屬性會初始化為目前的排程器(請參閱 Current)。With this constructor, the TaskCreationOptions property is initialized to creationOptions, the TaskContinuationOptions property is initialized to continuationOptions, and the TaskScheduler property is initialized to scheduler, unless it's null, in which case the property is initialized to the current scheduler (see Current).

另請參閱

適用於