Task.Factory.StartNew() basically receives an Action and returns a Task. In The Async CTP we have TaskEx.Run() which also receives an Action and returns a Task. They seem to do that same thing. Why TaskEx.Run() was introduced ?
Asked
Active
Viewed 1.0k times
13
-
11TaskEx.Run is now Task.Run in the .NET 4.5 RTM framework TaskEx was needed as a temporary measure – Simon_Weaver Sep 09 '12 at 07:21
2 Answers
14
Anders Hejlsberg talked about that briefly in an interview on Channel9. Apparently, Task.Run
is just a shorthand for Task.Factory.StartNew
. Its still early CTP days so we're unsure that Task.Run
will make it int. I personally hope it won't because it's kind of redundant. :)

Bruno Brant
- 8,226
- 7
- 45
- 90

aL3891
- 6,205
- 3
- 33
- 37
-
2It did :-) I wish the documentation for this mentioned it was a shorthand for Task.Factory.StartNew - http://msdn.microsoft.com/en-us/library/hh195051.aspx – Simon_Weaver Sep 09 '12 at 07:22
-
8This is just partially correct. [Blog post](http://blogs.msdn.com/b/pfxteam/archive/2011/10/24/10229468.aspx) talks about what to expect from `Task.Run`. Specially in the scenario where the action returns `Task
`, `Task.Factory.StartNew` would return a `Task – Anupam Aug 16 '13 at 17:26` requiring an `Unwrap` to get the inner task where as `Task.Run` would return a `Task ` with an implicit unwrap.
6
Stephen Toub covered it in his article. They are the same, one being shorthand for the other.

Bruno Brant
- 8,226
- 7
- 45
- 90