我可以使用任务并行库在.NET 3.5的项目? [英] Can I use the task parallel library in a .Net 3.5 project?
问题描述
我听说任务并行库可以在.NET 3.5的项目中使用。这是正确的,如果是,我该如何使用呢?在.NET 4.0中,它位于的System.Threading,但是当我选择的.Net 3.5在Visual Studio 2010中的目标,我没有得到访问类,如并行和并行循环。
I heard that the Task Parallel Library can be used in a .Net 3.5 project. Is this correct, and if yes, how do I use it? In .Net 4.0, it resides in System.Threading, but when I select .Net 3.5 as the target in Visual Studio 2010, I don't get access to classes like Parallel and the Parallel loops.
推荐答案
您无法使用的完全的并行扩展,不...
You can't use the full Parallel Extensions, no...
...但如果你安装无扩展了解.NET 3.5,即的comes一个版本并行扩展的,所以你可以使用它。我不知道有多少PFX的支持,但我怀疑有足以让大多数人。 (有在博客中的一些细节,但这是自2009年......我不知道在2010年可能会或可能不会被回迁任何修改。)
... but if you install Reactive Extensions for .NET 3.5, that comes with a version of Parallel Extensions, so you can use that. I don't know how much of PFX is supported, but I suspect there's enough for most people. (There are some details in the blog post, but that was from 2009... I don't know about any changes in 2010 which may or may not have been backported.)
请注意,这是不支持的,太 - 也许罚款爱好的项目,但如果我想用PFX商用,我想升级到.NET 4
Note that this is unsupported, too - probably fine for hobby projects, but if I wanted to use PFX commercially, I'd upgrade to .NET 4.
这篇关于我可以使用任务并行库在.NET 3.5的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!