开发者

What thread-safe collection classes are available in Silverlight 4?

I am developing an application framework that will be utilized by Silverlight on the client side and .NET 4 on the server side. Internally, the framework has dictionary and queue data structures where multiple threads will be accessing the collections concurrently.

On the server side, I would like to utilize the ConcurrentDictionary and ConcurrentQueue classes available in the System.Collections.Concurrent namespace. These classes however are not implemented in Silverlight 4.

The two approaches I am considering are:

  1. Decompile the ConcurrentDictionary and ConcurrentQueue classes and implement them in a Silverlight class library. These would be scoped u开发者_如何学JAVAsing the System.Collections.Concurrent namespace.
  2. Implement the custom thread-safe collection classes I need in a shared library (or find a reliable Silverlight thread-safe collection implementation) that can be used both server and client side.

The first approach would allow me to just implement the Silverlight data structures that I need, but I worry about introducing disparities between my Silverlight implementation and the concurrent collection classes implemented in .NET 4.

The second approach would provide a consistent concurrent collection implementation both client and server side, but feels like I would be reinventing the wheel.

It does not appear that implementing the ConcurrentDictionary and ConcurrentQueue classes in Silverlight would be very difficult, but is there already a well adopted library of thread-safe collection classes for Silverlight?


Try this out: http://ch.codeplex.com/


The class library for Mono includes implementations of the various concurrent collections, and is licensed under the very permissive MIT license.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜