© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
5 replies
salty_pepper

What do use in a multi-threaded environment?Dictionary with lock OR ConcurrentDictionary?

Doesn't Dictionary with lock make ConcurrentDictionary redundant?
As far as I understand to make dictionary thread safety we can just use lock to make sure other threads don't have access to the dictionary, why use ConcurrentDictionary ?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

multi threaded gate lock OR
C#CC# / help
2y ago
❔ Filter a ConcurrentDictionary
C#CC# / help
3y ago
✅ Collecting hotspot data on Linux in a threaded .NET environment
C#CC# / help
3y ago
❔ Optimising multi-threaded web API calls
C#CC# / help
3y ago