我可以在 .Net 3.5 项目中使用任务并行库吗? [英] Can I use the task parallel library in a .Net 3.5 project?

查看:33
本文介绍了我可以在 .Net 3.5 项目中使用任务并行库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

听说Task Parallel Library 可以在.Net 3.5 项目中使用.这是正确的,如果是,我该如何使用它?在 .Net 4.0 中,它驻留在 System.Threading 中,但是当我在 Visual Studio 2010 中选择 .Net 3.5 作为目标时,我无法访问 Parallel 和 Parallel 循环等类.

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.

推荐答案

(旧答案 - 3.5 的向后移植似乎不再可用.)

(Legacy answer - it seems the backport for 3.5 is no longer readily available.)

您不能使用完整并行扩展,不...

You can't use the full Parallel Extensions, no...

...但是如果您为 .NET 3.5 安装 Reactive Extensions附带一个版本的并行扩展,所以你可以使用它.我不知道支持多少 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屋!

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