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

偶尔善良 提交于 2019-12-08 16:02:51

问题


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 ?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/6123630/task-factory-startnew-vs-taskex-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!