I would say you've got the following options.
Some new Framework 4.0 classes:
- ConcurrentDictionary. Work fast and reliable.
- ConcurrentBag. It's unordered collection of objects, so it works faster, but suits if you don't need sorting only.
- ConcurrentStack. It's an implementation of the classic LIFO (Last-In First-Out) data structure that provides thread-safe access without the need for external synchronization
- ConcurrentQueue. It's a thread-safe FIFO (first in-first out) collection.
All new 4.0 classes work faster but have some features mentioned by levanovd. Performance comparison of these classes you can find here.
Some classic solutions from earlier versions:
- Dictionary + Monitor. Simple wrap to lock
- Dictionary + ReaderWriterLock. Better than the previous one, because has got read and write locks. So several threads can read, and just one - write.
- Dictionary + ReaderWriterLockSlim. It's just optimisation of the previous one.
- Hashtable. From my experience, it's the slowest method. Check Hashtable.Synchronized() method, it's a ready to go solution from Microsoft.
If I had a restriction of using Framework v3.5, I would use Dictionary + ReaderWriterLock or ReaderWriterLockSlim.