Is bool ConcurrentDictionary<TKey, TValue>.TryGetValue(TKey, out TValue) method thread-safe?
It's not quite clear from this post: https://devblogs.microsoft.com/pfxteam/concurrentdict开发者_开发百科ionarys-support-for-adding-and-updating/
Sure. Otherwise it would be useless, as this is a thread safe alternative to Dictionary<TKey, TValue>
. See the documentation: http://msdn.microsoft.com/en-us/library/dd287191.aspx:
Thread Safety
All public and protected members of
ConcurrentDictionary<TKey, TValue>
are thread-safe and may be used concurrently from multiple threads.
精彩评论