<PackageReference Include="Microsoft.Bcl" Version="1.1.8" />

System.Threading.Tasks.TaskFactory<TResult>

public class TaskFactory<TResult>
Provides support for creating and scheduling Task{TResult}Task{TResult} objects.

Gets the default CancellationTokenCancellationToken of this TaskFactory.

Gets the TaskCreationOptionsTaskContinuationOptions value of this TaskFactory{TResult}.

Gets the TaskCreationOptionsTaskCreationOptions value of this TaskFactory{TResult}.

public TaskScheduler Scheduler { get; }

Gets the TaskSchedulerTaskScheduler of this TaskFactory{TResult}.

public TaskFactory()

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

public TaskFactory(CancellationToken cancellationToken)

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

public TaskFactory(TaskScheduler scheduler)

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

public TaskFactory(TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions)

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

public TaskFactory(CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

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

public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction, CancellationToken cancellationToken)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

Creates a continuation Task{TResult}Task that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction, CancellationToken cancellationToken)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction, TaskContinuationOptions continuationOptions)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

Creates a continuation Task{TResult}Task that will be started upon the completion of any Task in the provided set.

public Task<TResult> FromAsync(IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod)

Creates a Task{TResult}Task that executes an end method function when a specified IAsyncResultIAsyncResult completes.

public Task<TResult> FromAsync(IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions)

Creates a Task{TResult}Task that executes an end method function when a specified IAsyncResultIAsyncResult completes.

public Task<TResult> FromAsync(IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions, TaskScheduler scheduler)

Creates a Task{TResult}Task that executes an end method function when a specified IAsyncResultIAsyncResult completes.

public Task<TResult> FromAsync(Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object state)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync(Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, object state, TaskCreationOptions creationOptions)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync<TArg1>(Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object state)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync<TArg1>(Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object state, TaskCreationOptions creationOptions)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)

Creates a Task{TResult}Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> StartNew(Func<TResult> function)

Creates and starts a Task{TResult}.

public Task<TResult> StartNew(Func<TResult> function, CancellationToken cancellationToken)

Creates and starts a Task{TResult}.

public Task<TResult> StartNew(Func<TResult> function, TaskCreationOptions creationOptions)

Creates and starts a Task{TResult}.

public Task<TResult> StartNew(Func<TResult> function, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)

Creates and starts a Task{TResult}.

public Task<TResult> StartNew(Func<object, TResult> function, object state)

Creates and starts a Task{TResult}.

public Task<TResult> StartNew(Func<object, TResult> function, object state, CancellationToken cancellationToken)

Creates and starts a Task{TResult}.

public Task<TResult> StartNew(Func<object, TResult> function, object state, TaskCreationOptions creationOptions)

Creates and starts a Task{TResult}.

public Task<TResult> StartNew(Func<object, TResult> function, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)

Creates and starts a Task{TResult}.