System.Threading.Tasks Namespace

Microsoft Silverlight will reach end of support after October 2021. Learn more.

The System.Threading.Tasks namespace provides types that simplify the work of writing concurrent and asynchronous code. The main types are System.Threading.Tasks.Task which represents an asynchronous operation that can be waited on and cancelled, and System.Threading.Tasks.Task<TResult>, which is a task that can return a value. The Factory class provides static methods for creating and starting tasks, and the System.Threading.Tasks.TaskScheduler class provides the default thread scheduling infrastructure.

Classes

  Class Description
Public class Task Represents an asynchronous operation.
Public class Task<TResult> Represents an asynchronous operation that can return a value.
Public class TaskCanceledException Represents an exception used to communicate task cancellation.
Public class TaskCompletionSource<TResult> Represents the producer side of a Task<TResult> unbound to a delegate, providing access to the consumer side through the Task property.
Public class TaskExtensions Provides a set of static (Shared in Visual Basic) methods for working with specific kinds of Task instances.
Public class TaskFactory Provides support for creating and scheduling Task objects.
Public class TaskFactory<TResult> Provides support for creating and scheduling Task<TResult> objects.
Public class TaskScheduler Represents an object that handles the low-level work of queuing tasks onto threads.
Public class TaskSchedulerException Represents an exception used to communicate an invalid operation by a TaskScheduler.
Public class UnobservedTaskExceptionEventArgs Provides data for the event that is raised when a faulted Task's exception goes unobserved.

Enumerations

  Enumeration Description
Public enumeration TaskContinuationOptions Specifies the behavior for a task that is created by using the ContinueWith or ContinueWith method.
Public enumeration TaskCreationOptions Specifies flags that control optional behavior for the creation and execution of tasks.
Public enumeration TaskStatus Represents the current stage in the lifecycle of a Task.

See Also

Reference

Other Resources