Frage im Code:
Code: Select all
ConcurrentDictionary cd = new ConcurrentDictionary();
// 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);
Ich denke, dass es nur dann false zurückgibt, wenn es keinen Wert für den angegebenen Schlüssel enthält, aber gewünscht wird um ganz sicher zu sein.