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

System.Threading.Tasks.TaskFactory

public class TaskFactory
Provides support for creating and scheduling TaskTasks.

Gets the default CancellationTokenCancellationToken of this TaskFactory.

Gets the TaskCreationOptionsTaskContinuationOptions value of this TaskFactory.

Gets the TaskCreationOptionsTaskCreationOptions value of this TaskFactory.

public TaskScheduler Scheduler { get; }

Gets the TaskSchedulerTaskScheduler of this TaskFactory.

public TaskFactory()

Initializes a TaskFactory instance with the default configuration.

public TaskFactory(CancellationToken cancellationToken)

Initializes a TaskFactory instance with the specified configuration.

public TaskFactory(TaskScheduler scheduler)

Initializes a TaskFactory instance with the specified configuration.

public TaskFactory(TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions)

Initializes a TaskFactory instance with the specified configuration.

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

Initializes a TaskFactory instance with the specified configuration.

public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, TaskContinuationOptions continuationOptions)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction, CancellationToken cancellationToken)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction, TaskContinuationOptions continuationOptions)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

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

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

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

Creates a continuation TaskTask that will be started upon the completion of a set of provided Tasks.

public Task<TResult> ContinueWhenAll<TResult>(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<TResult>(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, TResult>(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, TResult>(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, TResult>(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, TResult>(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 ContinueWhenAny(Task[] tasks, Action<Task> continuationAction)

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

public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken)

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

public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, TaskContinuationOptions continuationOptions)

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

public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

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

public Task<TResult> ContinueWhenAny<TResult>(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<TResult>(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<TResult>(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<TResult>(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, TResult>(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, TResult>(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, TResult>(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, TResult>(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 ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction)

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

public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction, CancellationToken cancellationToken)

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

public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction, TaskContinuationOptions continuationOptions)

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

public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)

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

public Task FromAsync(IAsyncResult asyncResult, Action<IAsyncResult> endMethod)

Creates a TaskTask that executes an end method action when a specified IAsyncResultIAsyncResult completes.

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

Creates a TaskTask that executes an end method action when a specified IAsyncResultIAsyncResult completes.

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

Creates a TaskTask that executes an end method action when a specified IAsyncResultIAsyncResult completes.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

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

Creates a TaskTask that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.

public Task<TResult> FromAsync<TResult>(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<TResult>(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<TResult>(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<TResult>(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<TResult>(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, TResult>(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, TResult>(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, TResult>(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, TResult>(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, TResult>(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, TResult>(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 StartNew(Action action)

Creates and starts a TaskTask.

public Task StartNew(Action action, CancellationToken cancellationToken)

Creates and starts a TaskTask.

public Task StartNew(Action action, TaskCreationOptions creationOptions)

Creates and starts a TaskTask.

public Task StartNew(Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)

Creates and starts a TaskTask.

public Task StartNew(Action<object> action, object state)

Creates and starts a TaskTask.

public Task StartNew(Action<object> action, object state, CancellationToken cancellationToken)

Creates and starts a TaskTask.

public Task StartNew(Action<object> action, object state, TaskCreationOptions creationOptions)

Creates and starts a TaskTask.

public Task StartNew(Action<object> action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)

Creates and starts a TaskTask.

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

Creates and starts a Task{TResult}.

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

Creates and starts a Task{TResult}.

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

Creates and starts a Task{TResult}.

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

Creates and starts a Task{TResult}.

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

Creates and starts a Task{TResult}.

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

Creates and starts a Task{TResult}.

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

Creates and starts a Task{TResult}.

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

Creates and starts a Task{TResult}.