Task.Factory.StartNew() vs. TaskEx.Run()

2019-06-15 09:37发布

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 ?

2条回答
淡お忘
2楼-- · 2019-06-15 09:53

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. :)

查看更多
成全新的幸福
3楼-- · 2019-06-15 10:04

Stephen Toub covered it in his article. They are the same, one being shorthand for the other.

查看更多
登录 后发表回答