Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Threading.​Tasks.​TaskFactory
Assembly: System.Runtime
Inheritance: object → TaskFactory
Provides support for creating and scheduling <see cref="T:System.Threading.Tasks.Task" /> objects.
Properties
public
CancellationToken
CancellationToken
Gets the default cancellation token for this task factory.
public
TaskContinuationOptions
ContinuationOptions
Gets the default task continuation options for this task factory.
public
TaskCreationOptions
CreationOptions
Gets the default task creation options for this task factory.
public
TaskScheduler
Scheduler
Gets the default task scheduler for this task factory.
Methods
public
Task
ContinueWhenAll​(Task[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken)
public
Task
ContinueWhenAll​(Task[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task
ContinueWhenAll​(Task[] tasks,
Action`1 continuationAction,
TaskContinuationOptions continuationOptions)
public
Task`1
ContinueWhenAll​(Task[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken)
public
Task`1
ContinueWhenAll​(Task[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task`1
ContinueWhenAll​(Task[] tasks,
Func`2 continuationFunction,
TaskContinuationOptions continuationOptions)
public
Task
ContinueWhenAll​(Task`1[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken)
public
Task
ContinueWhenAll​(Task`1[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task
ContinueWhenAll​(Task`1[] tasks,
Action`1 continuationAction,
TaskContinuationOptions continuationOptions)
public
Task`1
ContinueWhenAll​(Task`1[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken)
public
Task`1
ContinueWhenAll​(Task`1[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task`1
ContinueWhenAll​(Task`1[] tasks,
Func`2 continuationFunction,
TaskContinuationOptions continuationOptions)
public
Task
ContinueWhenAny​(Task[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken)
public
Task
ContinueWhenAny​(Task[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task
ContinueWhenAny​(Task[] tasks,
Action`1 continuationAction,
TaskContinuationOptions continuationOptions)
public
Task`1
ContinueWhenAny​(Task[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken)
public
Task`1
ContinueWhenAny​(Task[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task`1
ContinueWhenAny​(Task[] tasks,
Func`2 continuationFunction,
TaskContinuationOptions continuationOptions)
public
Task
ContinueWhenAny​(Task`1[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken)
public
Task
ContinueWhenAny​(Task`1[] tasks,
Action`1 continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task
ContinueWhenAny​(Task`1[] tasks,
Action`1 continuationAction,
TaskContinuationOptions continuationOptions)
public
Task`1
ContinueWhenAny​(Task`1[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken)
public
Task`1
ContinueWhenAny​(Task`1[] tasks,
Func`2 continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
public
Task`1
ContinueWhenAny​(Task`1[] tasks,
Func`2 continuationFunction,
TaskContinuationOptions continuationOptions)
public
Task
FromAsync​(Func`3 beginMethod,
Action`1 endMethod,
object state,
TaskCreationOptions creationOptions)
public
Task
FromAsync​(IAsyncResult asyncResult,
Action`1 endMethod,
TaskCreationOptions creationOptions)
public
Task
FromAsync​(IAsyncResult asyncResult,
Action`1 endMethod,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
public
Task`1
FromAsync​(Func`3 beginMethod,
Func`2 endMethod,
object state,
TaskCreationOptions creationOptions)
public
Task
FromAsync​(Func`4 beginMethod,
Action`1 endMethod,
TArg1 arg1,
object state)
public
Task
FromAsync​(Func`4 beginMethod,
Action`1 endMethod,
TArg1 arg1,
object state,
TaskCreationOptions creationOptions)
public
Task`1
FromAsync​(IAsyncResult asyncResult,
Func`2 endMethod,
TaskCreationOptions creationOptions)
public
Task`1
FromAsync​(IAsyncResult asyncResult,
Func`2 endMethod,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
public
Task`1
FromAsync​(Func`4 beginMethod,
Func`2 endMethod,
TArg1 arg1,
object state)
public
Task`1
FromAsync​(Func`4 beginMethod,
Func`2 endMethod,
TArg1 arg1,
object state,
TaskCreationOptions creationOptions)
public
Task
FromAsync​(Func`5 beginMethod,
Action`1 endMethod,
TArg1 arg1,
TArg2 arg2,
object state)
public
Task
FromAsync​(Func`5 beginMethod,
Action`1 endMethod,
TArg1 arg1,
TArg2 arg2,
object state,
TaskCreationOptions creationOptions)
public
Task`1
FromAsync​(Func`5 beginMethod,
Func`2 endMethod,
TArg1 arg1,
TArg2 arg2,
object state)
public
Task`1
FromAsync​(Func`5 beginMethod,
Func`2 endMethod,
TArg1 arg1,
TArg2 arg2,
object state,
TaskCreationOptions creationOptions)
public
Task
FromAsync​(Func`6 beginMethod,
Action`1 endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state)
public
Task
FromAsync​(Func`6 beginMethod,
Action`1 endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state,
TaskCreationOptions creationOptions)
public
Task`1
FromAsync​(Func`6 beginMethod,
Func`2 endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state)
public
Task`1
FromAsync​(Func`6 beginMethod,
Func`2 endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state,
TaskCreationOptions creationOptions)
public
Task
StartNew​(Action action)
action
The action delegate to execute asynchronously.
Returns The started task.
Creates and starts a task for the specified action delegate.
public
Task
StartNew​(Action action,
CancellationToken cancellationToken)
action
The action delegate to execute asynchronously.
cancellationToken
The cancellation token that will be assigned to the new task.
Returns The started task.
Creates and starts a task for the specified action delegate and cancellation token.
public
Task
StartNew​(Action action,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
action
The action delegate to execute asynchronously.
cancellationToken
The cancellation token that will be assigned to the new task.
creationOptions
One of the enumeration values that controls the behavior of the created task.
scheduler
The task scheduler that is used to schedule the created task.
Returns The started task.
Creates and starts a task for the specified action delegate, cancellation token, creation options and state.
public
Task
StartNew​(Action action,
TaskCreationOptions creationOptions)
action
The action delegate to execute asynchronously.
creationOptions
One of the enumeration values that controls the behavior of the created task.
Returns The started task.
Creates and starts a task for the specified action delegate and creation options.
public
Task
StartNew​(Action`1 action,
object state,
CancellationToken cancellationToken)
public
Task
StartNew​(Action`1 action,
object state,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
public
Task
StartNew​(Action`1 action,
object state,
TaskCreationOptions creationOptions)
public
Task`1
StartNew​(Func`2 function,
object state,
CancellationToken cancellationToken)
public
Task`1
StartNew​(Func`2 function,
object state,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
public
Task`1
StartNew​(Func`2 function,
object state,
TaskCreationOptions creationOptions)
public
Task`1
StartNew​(Func`1 function,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
public
bool
Equals​(object obj)
Inherited from object
obj
The object to compare with the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
int
GetHashCode​()
Inherited from object
Returns A hash code for the current object.
Serves as the default hash function.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.