Concurrent .NET

Concurrent collections for .NET

- Download - SF page - Subversion repository -

Introduction

Concurrent.NET is a library containing implementations of collection classes that can be safely accessed and modified by multiple threads at the same time. Right now it only contains an IDictionary implementation.

ConcurrentDictionary

ConcurrentDictionary is an IDictionary implementation that has the following characteristics:

There are two aspects to keep in mind. First of all, the Count method is not very efficient. Internally, it iterates over all keys. The result of Count is probably not very useful, because it can be out-dated the minute it is calculated. Second, the implementation does not 'scale down'. Once you have used the dictionary with one million of entries and go back to one thousand, the performance and memory characteristics will be worse than when you would start with one thousand entries. Scale down algorithms require locking and this impacts concurrency too much.