Duplicate keys in Dictionary<string,EventHandler>
I have
public static readonly Dictionary<string, EventHandler> CacheHandlers = new Dictionary<string, EventHandler>();
and I have duplicate keys in this dictionary:
debugger screenshot: http://i.stack.imgur.com/tuXI7.png
How does it happen?
Is it a bug in the .net framework or could it be 开发者_如何学JAVAan artifact of concurent usage?
MSDN states that Dictionarys might not be thread safe.
If you are concurrently reading from the Dictionary, then it might be safe so long as you lock the Dictionary when you add new key/value pairs.
精彩评论