Using lazy concurrent dictionary to ensure thread safety for unsafe methods
ConcurrentDictionary<TKey,TValue> provides several methods for adding or updating key/value pairs in the dictionary. All these operations are atomic and are thread-safe with regards to all other operations on this class. The only exceptions are the methods that accept a delegate, that is, GetOrAdd and AddOrUpdate.
In this repo, i m comparing 2 implementations (default one versus lazy one) of concurrent dictionary when dealing with methods like GetOrAdd or AddOrUpdate :
DefaultConcurrentDictionary: use default implementation of concurrent dictionary, methods likeGetOrAddorAddOrUpdateare not thread safe (see link)
LazyConcurrentDictionary: use custom implementation (run once, lazy-loading) of concurrent dictionary, methods likeGetOrAddorAddOrUpdateare thread safe (see link)
Tools : vs22, net 6.0
