I read code of AddOrUpdate method in Reference Source and saw that if oldValue and newValue are equaled the method will do the update anyway. Is it true? Did i understand it correct? Because of it the method always do lock.
update: When i saw the code of method AddOrUpdate i think "why we need use TryUpdate with lock if oldValue equals newValue? We can check equaling and return if values equals" Because of it i asked this question.
I understood why this method always do update or add, without checking equals of oldValue and newValue. TValue is object and we can't compare it without overwriting method equals.
Because of it, if you want AddOrUpdate without lock your ConcurrentDictionary when oldValue and newValue is equals, you need to create method with your classes. I don't know how you can do it using generic.