Is there any way to get the classes from System.Collections.Concurrent in .NET 3.5?
The question pretty much says it all.
Does anyone know of any way to get the collection classes from the System.Collections.Concurrent
namespace in .NET 3.5?
I guess what I'm asking is whether anyone has gone through the trouble of porting these classes to their own DLL that could be accessed from 开发者_StackOverflow中文版.NET 3.5.
Update: The reactive extensions library doesn't appear to be offered for .NET 3.5 anymore, sadly. However, if you can find an older version of the library, it definitely did contain backports of the concurrent collection classes for .NET 3.5. I know because I used them extensively at a previous company.
I just discovered this by accident.
It turns out these collections were available all along through Microsoft's Reactive Extensions (Rx) library, which is available for .NET 3.5, and which in fact I have been using already for some time (just never realized they were there).
The System.Collections.Concurrent
namespace is provided by System.Threading.dll.
Just posting this here for posterity.
No, they are in the 4.0 version of System.dll
. So trying to pull that in to a 3.5 app would not work.
I used the Task Parallel Library for .NET 3.5. Works great.
The package includes:
Task for executing asynchronous operations.
Concurrent Collections such as ConcurrentStack, ConcurentQueue ad ConcurrentDictionary.
PLINQ for writing parallel queries.
additional Threading operations such as Barrier,SpinLock and SpinWait.
精彩评论