Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a TaskFactory<TResult> instance.
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. |
Initializes a TaskFactory<TResult> instance with the default configuration.
public:
TaskFactory();
public TaskFactory();
Public Sub New ()
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).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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)
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.
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).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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)
The scheduler to use to schedule any tasks created with this TaskFactory<TResult>. A null value indicates that the current TaskScheduler should be used.
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).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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)
The default options to use when creating tasks with this TaskFactory<TResult>.
The default options to use when creating continuation tasks with this TaskFactory<TResult>.
creationOptions
or continuationOptions
specifies an invalid value.
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).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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)
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.
The default options to use when creating tasks with this TaskFactory<TResult>.
The default options to use when creating continuation tasks with this TaskFactory<TResult>.
The default scheduler to use to schedule any tasks created with this TaskFactory<TResult>. A null value indicates that Current should be used.
creationOptions
or continuationOptions
specifies an invalid value.
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).
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in