TaskFactory Constructors

Definition

Initializes a new instance of the TaskFactory class.

Overloads

TaskFactory()

Initializes a TaskFactory instance with the default configuration.

TaskFactory(CancellationToken)

Initializes a TaskFactory instance with the specified configuration.

TaskFactory(TaskScheduler)

Initializes a TaskFactory instance with the specified configuration.

TaskFactory(TaskCreationOptions, TaskContinuationOptions)

Initializes a TaskFactory instance with the specified configuration.

TaskFactory(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler)

Initializes a TaskFactory instance with the specified configuration.

TaskFactory()

Source:
TaskFactory.cs
Source:
TaskFactory.cs
Source:
TaskFactory.cs

Initializes a TaskFactory instance with the default configuration.

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

Remarks

This constructor creates a TaskFactory 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(CancellationToken)

Source:
TaskFactory.cs
Source:
TaskFactory.cs
Source:
TaskFactory.cs

Initializes a TaskFactory instance with the specified configuration.

public:
 TaskFactory(System::Threading::CancellationToken cancellationToken);
public TaskFactory (System.Threading.CancellationToken cancellationToken);
new System.Threading.Tasks.TaskFactory : System.Threading.CancellationToken -> System.Threading.Tasks.TaskFactory
Public Sub New (cancellationToken As CancellationToken)

Parameters

cancellationToken
CancellationToken

The CancellationToken that will be assigned to tasks created by this TaskFactory unless another CancellationToken is explicitly specified while calling the factory methods.

Remarks

This constructor creates a TaskFactory 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(TaskScheduler)

Source:
TaskFactory.cs
Source:
TaskFactory.cs
Source:
TaskFactory.cs

Initializes a TaskFactory 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 : System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.TaskFactory
Public Sub New (scheduler As TaskScheduler)

Parameters

scheduler
TaskScheduler

The TaskScheduler to use to schedule any tasks created with this TaskFactory. 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(TaskCreationOptions, TaskContinuationOptions)

Source:
TaskFactory.cs
Source:
TaskFactory.cs
Source:
TaskFactory.cs

Initializes a TaskFactory 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 : System.Threading.Tasks.TaskCreationOptions * System.Threading.Tasks.TaskContinuationOptions -> System.Threading.Tasks.TaskFactory
Public Sub New (creationOptions As TaskCreationOptions, continuationOptions As TaskContinuationOptions)

Parameters

creationOptions
TaskCreationOptions

The default TaskCreationOptions to use when creating tasks with this TaskFactory.

continuationOptions
TaskContinuationOptions

The default TaskContinuationOptions to use when creating continuation tasks with this TaskFactory.

Exceptions

The creationOptions argument specifies an invalid TaskCreationOptions value. For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).

-or-

The continuationOptions argument 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(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler)

Source:
TaskFactory.cs
Source:
TaskFactory.cs
Source:
TaskFactory.cs

Initializes a TaskFactory 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 : System.Threading.CancellationToken * System.Threading.Tasks.TaskCreationOptions * System.Threading.Tasks.TaskContinuationOptions * System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.TaskFactory
Public Sub New (cancellationToken As CancellationToken, creationOptions As TaskCreationOptions, continuationOptions As TaskContinuationOptions, scheduler As TaskScheduler)

Parameters

cancellationToken
CancellationToken

The default CancellationToken that will be assigned to tasks created by this TaskFactory unless another CancellationToken is explicitly specified while calling the factory methods.

creationOptions
TaskCreationOptions

The default TaskCreationOptions to use when creating tasks with this TaskFactory.

continuationOptions
TaskContinuationOptions

The default TaskContinuationOptions to use when creating continuation tasks with this TaskFactory.

scheduler
TaskScheduler

The default TaskScheduler to use to schedule any Tasks created with this TaskFactory. A null value indicates that TaskScheduler.Current should be used.

Exceptions

The creationOptions argument specifies an invalid TaskCreationOptions value. For more information, see the Remarks for FromAsync(Func<AsyncCallback,Object,IAsyncResult>, Action<IAsyncResult>, Object, TaskCreationOptions).

-or-

The continuationOptions argument 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