Windows Dev Center

TaskFactory(Of TResult) Class

Provides support for creating and scheduling Task(Of TResult) objects.

System.Object
  System.Threading.Tasks.TaskFactory(Of TResult)

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

'Declaration
Public Class TaskFactory(Of TResult)

Type Parameters

TResult

The type of the results that are available through the Task(Of TResult) objects that are associated with the methods in this class.

The TaskFactory(Of TResult) type exposes the following members.

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

  NameDescription
Public propertyCancellationTokenGets the default cancellation token for this task factory.
Public propertyContinuationOptionsGets the TaskContinuationOptions enumeration value for this task factory.
Public propertyCreationOptionsGets the TaskCreationOptions enumeration value for this task factory.
Public propertySchedulerGets the task scheduler for this task factory.
Top

  NameDescription
Public methodContinueWhenAll(Task(), Func(Of Task(), TResult))Creates a continuation task that will be started upon the completion of a set of provided tasks.
Public methodContinueWhenAll(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(Task(), Func(Of Task(), TResult), TaskContinuationOptions)Creates a continuation task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Task(), Func(Of Task(), TResult), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation task that will be started upon the completion of a set of provided Tasks.
Public methodContinueWhenAll(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult)(), 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)(), Func(Of Task(Of TAntecedentResult)(), TResult), 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)(), Func(Of Task(Of TAntecedentResult)(), TResult), TaskContinuationOptions)Creates a continuation task that will be started upon the completion of a set of provided tasks.
Public methodContinueWhenAll(Of TAntecedentResult)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult)(), TResult), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation task that will be started upon the completion of a set of provided tasks.
Public methodContinueWhenAny(Task(), Func(Of Task, TResult))Creates a continuation task that will be started upon the completion of any task in the provided set.
Public methodContinueWhenAny(Task(), Func(Of Task, TResult), CancellationToken)Creates a continuation task that will be started upon the completion of any task in the provided set.
Public methodContinueWhenAny(Task(), Func(Of Task, TResult), TaskContinuationOptions)Creates a continuation task that will be started upon the completion of any task in the provided set.
Public methodContinueWhenAny(Task(), Func(Of Task, TResult), 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)(Task(Of TAntecedentResult)(), Func(Of Task(Of TAntecedentResult), TResult))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)(), Func(Of Task(Of TAntecedentResult), TResult), 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)(), Func(Of Task(Of TAntecedentResult), TResult), TaskContinuationOptions)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)(), Func(Of Task(Of TAntecedentResult), TResult), CancellationToken, TaskContinuationOptions, TaskScheduler)Creates a continuation task 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, Func(Of IAsyncResult, TResult))Creates a task that executes an end method function when a specified IAsyncResult completes.
Public methodFromAsync(Func(Of AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), Object)Creates a task that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Public methodFromAsync(IAsyncResult, Func(Of IAsyncResult, TResult), TaskCreationOptions)Creates a task that executes an end method function when a specified IAsyncResult completes.
Public methodFromAsync(Func(Of AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), 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, Func(Of IAsyncResult, TResult), TaskCreationOptions, TaskScheduler)Creates a task that executes an end method function when a specified IAsyncResult completes.
Public methodFromAsync(Of TArg1)(Func(Of TArg1, AsyncCallback, Object, IAsyncResult), Func(Of IAsyncResult, TResult), 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 TArg1)(Func(Of TArg1, AsyncCallback, Object, IAsyncResult), Func(Of 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.
Public methodFromAsync(Of TArg1, TArg2)(Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), Func(Of 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.
Public methodFromAsync(Of TArg1, TArg2)(Func(Of TArg1, TArg2, AsyncCallback, Object, IAsyncResult), Func(Of 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.
Public methodFromAsync(Of TArg1, TArg2, TArg3)(Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), Func(Of 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.
Public methodFromAsync(Of TArg1, TArg2, TArg3)(Func(Of TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult), Func(Of 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.
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(Func(Of TResult))Creates and starts a task.
Public methodStartNew(Func(Of TResult), CancellationToken)Creates and starts a task.
Public methodStartNew(Func(Of TResult), TaskCreationOptions)Creates and starts a task.
Public methodStartNew(Func(Of Object, TResult), Object)Creates and starts a task.
Public methodStartNew(Func(Of Object, TResult), Object, CancellationToken)Creates and starts a task.
Public methodStartNew(Func(Of Object, TResult), Object, TaskCreationOptions)Creates and starts a task.
Public methodStartNew(Func(Of TResult), CancellationToken, TaskCreationOptions, TaskScheduler)Creates and starts a task.
Public methodStartNew(Func(Of Object, TResult), Object, CancellationToken, TaskCreationOptions, TaskScheduler)Creates and starts a task.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The TaskFactory(Of TResult) class encodes some common Task(Of TResult) patterns into methods that pick up default settings, which are configurable through its constructors.

A default instance of TaskFactory(Of TResult) is available through the Factory property.

Windows Phone OS

Supported in: 8.1, 8.0

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

Show:
© 2015 Microsoft