Прочитај на енглеском Уреди

Делите путем


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.

C#
public TaskFactory();

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

.NET 10 и друге верзије
Производ Верзије
.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

TaskFactory<TResult>(CancellationToken)

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

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

C#
public TaskFactory(System.Threading.CancellationToken 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

.NET 10 и друге верзије
Производ Верзије
.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

TaskFactory<TResult>(TaskScheduler)

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

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

C#
public TaskFactory(System.Threading.Tasks.TaskScheduler scheduler);
C#
public TaskFactory(System.Threading.Tasks.TaskScheduler? scheduler);

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

.NET 10 и друге верзије
Производ Верзије
.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

TaskFactory<TResult>(TaskCreationOptions, TaskContinuationOptions)

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

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

C#
public TaskFactory(System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions);

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

.NET 10 и друге верзије
Производ Верзије
.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

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

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

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

C#
public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler);
C#
public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler? scheduler);

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

.NET 10 и друге верзије
Производ Верзије
.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