Consider using ConcurrentDictionary . It can have many locks for effective simultaneous interactions, and its methods strongly encourage simultaneous thinking, such as AddOrUpdateand GetOrAdd, both of which have overloads with functions and objects.
source
share