Task.Run Method

.NET Framework 4.5

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

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Static member Run(Action) Queues the specified work to run on the ThreadPool and returns a task handle for that work.
Public method Static member Run<TResult>(Func<Task<TResult>>) Queues the specified work to run on the ThreadPool and returns a proxy for the Task(TResult) returned by function.
Public method Static member Run(Func<Task>) Queues the specified work to run on the ThreadPool and returns a proxy for the task returned by function.
Public method Static member Run<TResult>(Func<TResult>) Queues the specified work to run on the ThreadPool and returns a Task(TResult) handle for that work.
Public method Static member Run(Action, CancellationToken) Queues the specified work to run on the ThreadPool and returns a task handle for that work.
Public method Static member Run<TResult>(Func<Task<TResult>>, CancellationToken) Queues the specified work to run on the ThreadPool and returns a proxy for the Task(TResult) returned by function.
Public method Static member Run(Func<Task>, CancellationToken) Queues the specified work to run on the ThreadPool and returns a proxy for the task returned by function.
Public method Static member Run<TResult>(Func<TResult>, CancellationToken) Queues the specified work to run on the thread pool and returns a Task(TResult) handle for that work.
Top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft