TaskFactory Class

May 11, 2014

Provides support for creating and scheduling Task objects.

System.Object
  System.Threading.Tasks.TaskFactory

Namespace:  System.Threading.Tasks
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Class TaskFactory

The TaskFactory type exposes the following members.

  NameDescription
Public methodTaskFactoryInitializes a TaskFactory instance with the default configuration.
Public methodTaskFactory(CancellationToken)Initializes a TaskFactory instance with the specified configuration.
Public methodTaskFactory(TaskScheduler)Initializes a TaskFactory instance with the specified configuration.
Public methodTaskFactory(TaskCreationOptions, TaskContinuationOptions)Initializes a TaskFactory instance with the specified configuration.
Public methodTaskFactory(CancellationToken, TaskCreationOptions, TaskContinuationOptions, TaskScheduler)Initializes a TaskFactory instance with the specified configuration.
Top

  NameDescription
Public propertyCancellationTokenGets the default CancellationToken of this TaskFactory.
Public propertyContinuationOptionsGets the TaskContinuationOptions value of this TaskFactory.
Public propertyCreationOptionsGets the TaskCreationOptions value of this TaskFactory.
Public propertySchedulerGets the TaskScheduler of this TaskFactory.
Top

  NameDescription
Public methodContinueWhenAll(Task(), Action(Of Task()))Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Task(), Action(Of Task()), CancellationToken)Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Task(), Action(Of Task()), TaskContinuationOptions)Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Task(), Action(Of Task()), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TResult)(Task(), Func(Of Task(), TResult))Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)()))Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TResult)(Task(), Func(Of Task(), TResult), CancellationToken)Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TResult)(Task(), Func(Of Task(), TResult), TaskContinuationOptions)Creates a continuation Task(Of TResult) that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)()), CancellationToken)Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)()), TaskContinuationOptions)Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TResult)(Task(), Func(Of Task(), TResult), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task(Of TResult) that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)()), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult)(), TResult))Creates a continuation Task(Of TResult) that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult)(), TResult), CancellationToken)Creates a continuation Task(Of TResult) that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult)(), TResult), TaskContinuationOptions)Creates a continuation Task(Of TResult) that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult)(), TResult), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task(Of TResult) that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAny(Task(), Action(Of Task))Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Task(), Action(Of Task), CancellationToken)Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Task(), Action(Of Task), TaskContinuationOptions)Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Task(), Action(Of Task), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TResult)(Task(), Func(Of Task, TResult))Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)))Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TResult)(Task(), Func(Of Task, TResult), CancellationToken)Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TResult)(Task(), Func(Of Task, TResult), TaskContinuationOptions)Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)), CancellationToken)Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)), TaskContinuationOptions)Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TResult)(Task(), Func(Of Task, TResult), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Action(Of Task(Of TAntecedentResult)), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult), TResult))Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult), TResult), CancellationToken)Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult), TResult), TaskContinuationOptions)Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodContinueWhenAny(Of TAntecedentResult, TResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult), TResult), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation Task(Of TResult) that will be started upon the completion of any Task in the provided set.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodFromAsync(IAsyncResult, Action(Of IAsyncResult))Creates a Task that executes an end method action when a specified IAsyncResult completes.
Public methodFromAsync(Func(Of AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), Object)Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(IAsyncResult, Action(Of IAsyncResult), TaskCreationOptions)Creates a Task that executes an end method action when a specified IAsyncResult completes.
Public methodFromAsync(Func(Of AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), Object, TaskCreationOptions)Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(IAsyncResult, Action(Of IAsyncResult), TaskCreationOptions, TaskScheduler)Creates a Task that executes an end method action when a specified IAsyncResult completes.
Public methodFromAsync(Of TResult)(IAsyncResult, Func(Of IAsyncResult, TResult))Creates a Task(Of TResult) that executes an end method function when a specified IAsyncResult completes.
Public methodFromAsync(Of TResult)(Func(Of AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), Object)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TResult)(IAsyncResult, Func(Of IAsyncResult, TResult), TaskCreationOptions)Creates a Task(Of TResult) that executes an end method function when a specified IAsyncResult completes.
Public methodFromAsync(Of TResult)(Func(Of AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), Object, TaskCreationOptions)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1)(Func(Of TArg1, AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), TArg1, Object)Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TResult)(IAsyncResult, Func(Of IAsyncResult, TResult), TaskCreationOptions, TaskScheduler)Creates a Task(Of TResult) that executes an end method function when a specified IAsyncResult completes.
Public methodFromAsync(Of TArg1)(Func(Of TArg1, AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), TArg1, Object, TaskCreationOptions)Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TResult)(Func(Of TArg1, AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), TArg1, Object)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TResult)(Func(Of TArg1, AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), TArg1, Object, TaskCreationOptions)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TArg2)(Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), TArg1, TArg2, Object)Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TArg2)(Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), TArg1, TArg2, Object, TaskCreationOptions)Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TArg2, TResult)(Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), TArg1, TArg2, Object)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TArg2, TResult)(Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), TArg1, TArg2, Object, TaskCreationOptions)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TArg2, TArg3)(Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), TArg1, TArg2, TArg3, Object)Creates a Task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TArg2, TArg3)(Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), Action(Of IAsyncResult), 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.
Public methodFromAsync(Of TArg1, TArg2, TArg3, TResult)(Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), TArg1, TArg2, TArg3, Object)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(Of TArg1, TArg2, TArg3, TResult)(Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), TArg1, TArg2, TArg3, Object, TaskCreationOptions)Creates a Task(Of TResult) that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStartNew(Action)Creates and starts a Task.
Public methodStartNew(Action, CancellationToken)Creates and starts a Task.
Public methodStartNew(Action, TaskCreationOptions)Creates and starts a Task.
Public methodStartNew(Action(Of Object), Object)Creates and starts a Task.
Public methodStartNew(Action(Of Object), Object, CancellationToken)Creates and starts a Task.
Public methodStartNew(Action(Of Object), Object, TaskCreationOptions)Creates and starts a Task.
Public methodStartNew(Action, CancellationToken, TaskCreationOptions, TaskScheduler)Creates and starts a Task.
Public methodStartNew(Action(Of Object), Object, CancellationToken, TaskCreationOptions, TaskScheduler)Creates and starts a Task.
Public methodStartNew(Of TResult)(Func(Of TResult))Creates and starts a Task(Of TResult).
Public methodStartNew(Of TResult)(Func(Of TResult), CancellationToken)Creates and starts a Task(Of TResult).
Public methodStartNew(Of TResult)(Func(Of TResult), TaskCreationOptions)Creates and starts a Task(Of TResult).
Public methodStartNew(Of TResult)(Func(Of Object, TResult), Object)Creates and starts a Task(Of TResult).
Public methodStartNew(Of TResult)(Func(Of Object, TResult), Object, CancellationToken)Creates and starts a Task(Of TResult).
Public methodStartNew(Of TResult)(Func(Of Object, TResult), Object, TaskCreationOptions)Creates and starts a Task(Of TResult).
Public methodStartNew(Of TResult)(Func(Of TResult), CancellationToken, TaskCreationOptions, TaskScheduler)Creates and starts a Task(Of TResult).
Public methodStartNew(Of TResult)(Func(Of Object, TResult), Object, CancellationToken, TaskCreationOptions, TaskScheduler)Creates and starts a Task(Of TResult).
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The TaskFactory class encodes some common Task patterns into methods that pick up default settings, which are configurable through its constructors. A default instance of TaskFactory is available through the Factory property.

Windows Phone OS

Supported in: 8.1, 8.0

All public and protected members of TaskFactory are thread-safe and may be used concurrently from multiple threads.

Show:
© 2014 Microsoft