I read the MSDN documentation but didn't really understand it.
I believe that the behavior of Set
is "replace existing, or add" (atomically).
Is that correct?
I read the MSDN documentation but didn't really understand it.
I believe that the behavior of Set
is "replace existing, or add" (atomically).
Is that correct?
Add
does nothing (returnsfalse
) if there is already a value for that key.Set
does an insert or update, as necessary.Remove
+Add
would leave a gap in the middle when another thread querying that key would get no clue (Set
does not; the swap is typically atomic); as such, whileSet
has the same end result asRemove
+Add
, the mechanism difference is important since it could impact other callers.For example of Add: