Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Task.Run Method

.NET Framework (current version)
 

Queues the specified work to run on the ThreadPool and returns a task or Task<TResult> handle for that work.

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticRun(Action)

Queues the specified work to run on the thread pool and returns a Task object that represents that work.

System_CAPS_pubmethodSystem_CAPS_staticRun(Action, CancellationToken)

Queues the specified work to run on the thread pool and returns a Task object that represents that work. A cancellation token allows the work to be cancelled.

System_CAPS_pubmethodSystem_CAPS_staticRun(Func<Task>)

Queues the specified work to run on the thread pool and returns a proxy for the task returned by function.

System_CAPS_pubmethodSystem_CAPS_staticRun(Func<Task>, CancellationToken)

Queues the specified work to run on the thread pool and returns a proxy for the task returned by function.

System_CAPS_pubmethodSystem_CAPS_staticRun<TResult>(Func<TResult>)

Queues the specified work to run on the thread pool and returns a Task<TResult> object that represents that work.

System_CAPS_pubmethodSystem_CAPS_staticRun<TResult>(Func<TResult>, CancellationToken)

Queues the specified work to run on the thread pool and returns a Task(TResult) object that represents that work. A cancellation token allows the work to be cancelled.

System_CAPS_pubmethodSystem_CAPS_staticRun<TResult>(Func<Task<TResult>>)

Queues the specified work to run on the thread pool and returns a proxy for the Task(TResult) returned by function.

System_CAPS_pubmethodSystem_CAPS_staticRun<TResult>(Func<Task<TResult>>, CancellationToken)

Queues the specified work to run on the thread pool and returns a proxy for the Task(TResult) returned by function.

The Run method provides a set of overloads that make it easy to start a task by using default values. It is a lightweight alternative to the StartNew overloads.

Return to top
Show:
© 2016 Microsoft