I've used the ConcurrentDictionary
in .Net and fell in love with how easy it is to write concurrent classes using it.
Now, I have a different scenario though. I basically need to keep track of a single object type in an non-duplicated unordered list, so basically a Set<T>
type thing, except for it needs all of the thread-safety I've come to expect from ConcurrentDictionary
, so having things like GetOrAdd
.
Is there anything like this built into .Net?
I've considered just using ConcurrentDictionary and only worrying about the key, and never using the value, but this seems very sub-optimal