Are both method threadsafe. I mean if two processes try to access the dictionary at the same time, it will not throw an exception?
Yes they are thread safe. The ConcurrentDictionary class internally uses Monitor(C# lock). You can see
this for understanding why normal dictionaries are not thread safe.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Marked as answer by pantonis on May 06, 2012 08:44 AM
imran_ku07
All-Star
45847 Points
7710 Posts
MVP
Re: Concurrent dictionary thread safe
May 05, 2012 07:28 AM|LINK
Yes they are thread safe. The ConcurrentDictionary class internally uses Monitor(C# lock). You can see this for understanding why normal dictionaries are not thread safe.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD