开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜