I have a mapping where each key could have multiple associated values. I thought that a ConcurrentDictionary might help me more easily code this map for use in a multithreaded environment, but the methods seem to be built around a single value. I see that AddOrUpdate() lets me modify the value if it already exists, but it doesn't guarantee atomicity for that operation so it seems pointless? Does anyone have a good strategy for tackling this situation?
Sorry, I guess I was being a bit vague. I'd like to have multiple values for a key, ie have an IList associated with the key. But I want to be able to add/remove values from the multi-value in a safe manner. It just looked like the AddOrUpdate + delegate method might result in things getting lost if multiple calls to it were made at the same-ish time?