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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Adddoes nothing (returnsfalse) if there is already a value for that key.Setdoes an insert or update, as necessary.Remove+Addwould leave a gap in the middle when another thread querying that key would get no clue (Setdoes not; the swap is typically atomic); as such, whileSethas the same end result asRemove+Add, the mechanism difference is important since it could impact other callers.For example of Add: