Id like to make use of a ConcurrentKeyedCollection - but it doesn't exist.
Why no ConcurrentKeyedCollection?
What should I be using? (ConcurrentDictionary? Wrap my own concurrency protection around a KeyedCollection?)
Asked
Active
Viewed 1,108 times
1

Ricibob
- 7,505
- 5
- 46
- 65
1 Answers
3
SynchronizedKeyedCollection introduced in .NET 2.0 does the job - using a List and wrapping access in a lock. Note that the newer "Concurrent" collections introduced in .NET 4.0 used an improved mechanism and should scale better - but they dont offer a KeyedCollection. More info on "Synchronized" vs "Concurrent" collections here.
-
Is this still true in 2022 regarding the Concurrent Collection ? – StackHola Oct 28 '22 at 09:40