編輯

共用方式為


TaskFactory<TResult> Constructors

Definition

Initializes a TaskFactory<TResult> instance.

Overloads

TaskFactory<TResult>()

Initializes a TaskFactory<TResult> instance with the default configuration.

TaskFactory<TResult>(CancellationToken)

Initializes a TaskFactory<TResult> instance with the default configuration.

TaskFactory<TResult>(TaskScheduler)

Initializes a TaskFactory<TResult> instance with the specified configuration.

TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions)

Initializes a TaskFactory<TResult> instance with the specified configuration.

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

Initializes a TaskFactory<TResult> instance with the specified configuration.

TaskFactory<TResult>()

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Initializes a TaskFactory<TResult> instance with the default configuration.

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

Remarks

This constructor creates a TaskFactory<TResult> instance with a default configuration. 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).

See also

Applies to

TaskFactory<TResult>(CancellationToken)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

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>
Public Sub New (cancellationToken As CancellationToken)

Parameters

cancellationToken
CancellationToken

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.

Remarks

This constructor creates a TaskFactory<TResult> instance with a default configuration. 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).

See also

Applies to

TaskFactory<TResult>(TaskScheduler)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

Initializes a TaskFactory<TResult> instance with the specified configuration.

public:
 TaskFactory(System::Threading::Tasks::TaskScheduler ^ scheduler);
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)

Parameters

scheduler
TaskScheduler

The scheduler to use to schedule any tasks created with this TaskFactory<TResult>. A null value indicates that the current TaskScheduler should be used.

Remarks

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).

See also

Applies to

TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions)

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

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)

Parameters

creationOptions
TaskCreationOptions

The default options to use when creating tasks with this TaskFactory<TResult>.

continuationOptions
TaskContinuationOptions

The default options to use when creating continuation tasks with this TaskFactory<TResult>.

Exceptions

creationOptions or continuationOptions specifies an invalid value.

Remarks

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).

See also

Applies to

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

Source:
FutureFactory.cs
Source:
FutureFactory.cs
Source:
FutureFactory.cs

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);
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>
Public Sub New (cancellationToken As CancellationToken, creationOptions As TaskCreationOptions, continuationOptions As TaskContinuationOptions, scheduler As TaskScheduler)

Parameters

cancellationToken
CancellationToken

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

The default options to use when creating tasks with this TaskFactory<TResult>.

continuationOptions
TaskContinuationOptions

The default options to use when creating continuation tasks with this TaskFactory<TResult>.

scheduler
TaskScheduler

The default scheduler to use to schedule any tasks created with this TaskFactory<TResult>. A null value indicates that Current should be used.

Exceptions

creationOptions or continuationOptions specifies an invalid value.

Remarks

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).

See also

Applies to