TaskFactory<TResult> Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Provides support for creating and scheduling Task<TResult> objects.
Assembly: mscorlib (in mscorlib.dll)
Type Parameters
- TResult
The type of the results that are available through the Task<TResult> objects that are associated with the methods in this class.
The TaskFactory<TResult> type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | 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. |
| Name | Description | |
|---|---|---|
![]() | CancellationToken | Gets the default cancellation token for this task factory. |
![]() | ContinuationOptions | Gets the TaskContinuationOptions enumeration value for this task factory. |
![]() | CreationOptions | Gets the TaskCreationOptions enumeration value for this task factory. |
![]() | Scheduler | Gets the task scheduler for this task factory. |
| Name | Description | |
|---|---|---|
![]() | ContinueWhenAll(Task[], Func<Task[], TResult>) | Creates a continuation task that will be started upon the completion of a set of provided tasks. |
![]() | ContinueWhenAll(Task[], Func<Task[], TResult>, CancellationToken) | Creates a continuation task that will be started upon the completion of a set of provided tasks. |
![]() | ContinueWhenAll(Task[], Func<Task[], TResult>, TaskContinuationOptions) | Creates a continuation task that will be started upon the completion of a set of provided Tasks. |
![]() | ContinueWhenAll(Task[], Func<Task[], TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) | Creates a continuation task that will be started upon the completion of a set of provided Tasks. |
![]() | ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>[], TResult>) | Creates a continuation task that will be started upon the completion of a set of provided tasks. |
![]() | ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>[], TResult>, CancellationToken) | Creates a continuation task that will be started upon the completion of a set of provided tasks. |
![]() | ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>[], TResult>, TaskContinuationOptions) | Creates a continuation task that will be started upon the completion of a set of provided tasks. |
![]() | ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>[], TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) | Creates a continuation task that will be started upon the completion of a set of provided tasks. |
![]() | ContinueWhenAny(Task[], Func<Task, TResult>) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | ContinueWhenAny(Task[], Func<Task, TResult>, CancellationToken) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | ContinueWhenAny(Task[], Func<Task, TResult>, TaskContinuationOptions) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | ContinueWhenAny(Task[], Func<Task, TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>, TResult>) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>, TResult>, CancellationToken) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>, TResult>, TaskContinuationOptions) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[], Func<Task<TAntecedentResult>, TResult>, CancellationToken, TaskContinuationOptions, TaskScheduler) | Creates a continuation task that will be started upon the completion of any task in the provided set. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | FromAsync(IAsyncResult, Func<IAsyncResult, TResult>) | Creates a task that executes an end method function when a specified IAsyncResult completes. |
![]() | FromAsync(Func<AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, Object) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | FromAsync(IAsyncResult, Func<IAsyncResult, TResult>, TaskCreationOptions) | Creates a task that executes an end method function when a specified IAsyncResult completes. |
![]() | FromAsync(Func<AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, Object, TaskCreationOptions) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | FromAsync(IAsyncResult, Func<IAsyncResult, TResult>, TaskCreationOptions, TaskScheduler) | Creates a task that executes an end method function when a specified IAsyncResult completes. |
![]() | FromAsync<TArg1>(Func<TArg1, AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, TArg1, Object) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | FromAsync<TArg1>(Func<TArg1, AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, TArg1, Object, TaskCreationOptions) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, TArg1, TArg2, Object) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | FromAsync<TArg1, TArg2>(Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, TArg1, TArg2, Object, TaskCreationOptions) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, TArg1, TArg2, TArg3, Object) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | FromAsync<TArg1, TArg2, TArg3>(Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult>, Func<IAsyncResult, TResult>, TArg1, TArg2, TArg3, Object, TaskCreationOptions) | Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | StartNew(Func<TResult>) | Creates and starts a task. |
![]() | StartNew(Func<TResult>, CancellationToken) | Creates and starts a task. |
![]() | StartNew(Func<TResult>, TaskCreationOptions) | Creates and starts a task. |
![]() | StartNew(Func<Object, TResult>, Object) | Creates and starts a task. |
![]() | StartNew(Func<Object, TResult>, Object, CancellationToken) | Creates and starts a task. |
![]() | StartNew(Func<Object, TResult>, Object, TaskCreationOptions) | Creates and starts a task. |
![]() | StartNew(Func<TResult>, CancellationToken, TaskCreationOptions, TaskScheduler) | Creates and starts a task. |
![]() | StartNew(Func<Object, TResult>, Object, CancellationToken, TaskCreationOptions, TaskScheduler) | Creates and starts a task. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The TaskFactory<TResult> class encodes some common Task<TResult> patterns into methods that pick up default settings, which are configurable through its constructors.
A default instance of TaskFactory<TResult> is available through the Factory property.


