Task.Factory.StartNew()与TaskEx.Run() [英] Task.Factory.StartNew() vs. TaskEx.Run()

查看:315
本文介绍了Task.Factory.StartNew()与TaskEx.Run()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Task.Factory.StartNew()基本上接收操作,并返回一个任务。在异步CTP我们有TaskEx.Run(),这也接收操作,并返回一个任务。他们似乎做同样的事情。为什么TaskEx.Run()介绍?

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 ?

推荐答案

安德斯·海尔斯伯格谈到了短暂采访时 Channel9的 。显然, Task.Run 仅仅是 Task.Factory.StartNew 的简写。其还早CTP天所以我们不能确定 Task.Run 将使它诠释。我个人希望它不会因为它是一种多余的。 :)

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

这篇关于Task.Factory.StartNew()与TaskEx.Run()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆