KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Will it only return false if the dictionary does not contain a value for the given key or will it also return false due to thread race conditions, like another thread adds/updates something? Question in code: ConcurrentDictionary<int, string> cd = new ConcurrentDictionary<int, string>(); // This might fail if another thread is adding with key value of 1. cd.TryAdd(1, "one"); // Will this ever fail if no other thread ever removes with the key value of 1? cd.TryRemove(1); Edit: I think that it only will return false if it does not contain a value for the given key, but want to be absolutely sure.
Tags (comma-separated)
Save Edits
Cancel