Есть ли способ определить, было ли значение успешно найдено или оно было добавлено при использовании ConcurrentDictionar ⇐ C#
-
Anonymous
Есть ли способ определить, было ли значение успешно найдено или оно было добавлено при использовании ConcurrentDictionar
I have some code that uses the GetOrAdd function from ConcurrentDictionary to add values with a unique key to a holder. However, I want to be able to tell if a values key is found (i.e. a true returned from TryGet) or whether it has to be added.
I haven't been able to find anything online that suggests this is achievable so if anyone has any ideas it would be really helpful.
Источник: https://stackoverflow.com/questions/764 ... f-it-was-a
I have some code that uses the GetOrAdd function from ConcurrentDictionary to add values with a unique key to a holder. However, I want to be able to tell if a values key is found (i.e. a true returned from TryGet) or whether it has to be added.
I haven't been able to find anything online that suggests this is achievable so if anyone has any ideas it would be really helpful.
Источник: https://stackoverflow.com/questions/764 ... f-it-was-a
Мобильная версия