1

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?)

Ricibob
  • 7,505
  • 5
  • 46
  • 65

1 Answers1

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.

Community
  • 1
  • 1
Ricibob
  • 7,505
  • 5
  • 46
  • 65