Under what circumstances does ConcurrentDictionary.TryRemove () return false?

I was looking for a way to remove an item from a parallel dictionary. For some reason, there is no method Remove

, but there is a method TryRemove

that returns a bool

. On MSDN, he said he false

returns in case the process "failed", but does not say how.

  • Is it false when the element is only missing?
  • Is it false if the item cannot be removed due to a lock?
+3


source to share


1 answer


1st option: when there is no key to delete; locking Internal implementation of ConcurrentDictionary and must not be visible from the outside.



According to Dmitry Bychenko.

+3


source







All Articles