Making ConcurrentDictionary GetOrAdd thread safe using Lazy

added by DotNetKicks
11/15/2016 11:19:15 AM

3 Kicks, 244 Views

I was browsing the ASP.NET Core MVC GitHub repo the other day, checking out the new 1.1.0 Preview 1 code, when I spotted a usage of ConcurrentDictionary that I thought was interesting. This post explores the GetOrAdd function, the level of thread safety it provides, and ways to add additional threading constraints.


0 comments