System.Threading.Tasks.TaskContinuationOptions Enumeration

Specifies the behavior for a task that is created by using the Task.ContinueWith(Action<System.Threading.Tasks.Task>,System.Threading.CancellationToken,System.Threading.Tasks.TaskContinuationOptions,System.Threading.Tasks.TaskScheduler) or Task`1.ContinueWith(Action<Task<`0>>,System.Threading.Tasks.TaskContinuationOptions) method.

Syntax

[System.Flags]
public enum TaskContinuationOptions

Remarks

Documentation for this section has not yet been entered.

Members

Member NameDescription
AttachedToParent

Specifies that a task is attached to a parent in the task hierarchy.

DenyChildAttach

Specifies that an InvalidOperationException will be thrown if an attempt is made to attach a child task to the created task.

ExecuteSynchronously

Specifies that the continuation task should be executed synchronously. With this option specified, the continuation will be run on the same thread that causes the antecedent task to transition into its final state. If the antecedent is already complete when the continuation is created, the continuation will run on the thread creating the continuation. Only very short-running continuations should be executed synchronously.

HideScheduler

Prevents the ambient scheduler from being seen as the current scheduler in the created task. This means that operations like StartNew or ContinueWith that are performed in the created task will see TaskScheduler.Default as the current scheduler.

LazyCancellation

In the case of continuation cancellation, prevents completion of the continuation until the antecedent has completed.

LongRunning

Specifies that a task will be a long-running, course-grained operation. It provides a hint to the System.Threading.Tasks.TaskScheduler that oversubscription may be warranted.

None

Default = "Continue on any, no task options, run asynchronously" Specifies that the default behavior should be used. Continuations, by default, will be scheduled when the antecedent task completes, regardless of the task's final System.Threading.Tasks.TaskStatus.

NotOnCanceled

Specifies that the continuation task should not be scheduled if its antecedent was canceled. This option is not valid for multi-task continuations.

NotOnFaulted

Specifies that the continuation task should not be scheduled if its antecedent threw an unhandled exception. This option is not valid for multi-task continuations.

NotOnRanToCompletion

Specifies that the continuation task should not be scheduled if its antecedent ran to completion. This option is not valid for multi-task continuations.

OnlyOnCanceled

Specifies that the continuation task should be scheduled only if its antecedent was canceled. This option is not valid for multi-task continuations.

OnlyOnFaulted

Specifies that the continuation task should be scheduled only if its antecedent threw an unhandled exception. This option is not valid for multi-task continuations.

OnlyOnRanToCompletion

Specifies that the continuation task should be scheduled only if its antecedent ran to completion. This option is not valid for multi-task continuations.

PreferFairness

A hint to a System.Threading.Tasks.TaskScheduler to schedule a task in as fair a manner as possible, meaning that tasks scheduled sooner will be more likely to be run sooner, and tasks scheduled later will be more likely to be run later.

Requirements

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