Can I use the task parallel library in a .Net 3.5 project?
(Legacy answer - it seems the backport for 3.5 is no longer readily available.)
You can't use the full Parallel Extensions, no...
... 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.)
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.
As Jon Skeet mentioned, Rx
backported TPL
to .NET 3.5
.
I have made a nuget (called TaskParallelLibrary) out of their System.Threading.dll
, for easier integration.
You can get it from http://nuget.org/packages/TaskParallelLibrary.