Index was outside the bounds of the array错误,如何解决?
[已解决] Index was outside the bounds of the array错误,如何解决?
当前页面:http://www.senparc.com/SZD-158
{ 收藏当前页面 }
20
[软件及编程 > C#]
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary`2.Resize()
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
这是什么问题?我使用Add方法添加,Key也没有重复,怎么会出错的呢?
at System.Collections.Generic.Dictionary`2.Resize()
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
这是什么问题?我使用Add方法添加,Key也没有重复,怎么会出错的呢?
最佳答案
你是不是用了多线程访问这个Dictionary的?如果是的话,可以使用lock锁,并且可以试试看dic[xx] = xx的方式赋值。
回答时间:2010/7/20 12:35:19
| 回答者:Souidea
其他参考答案(0)
提交失败!请检查错误!错误信息:
以下信息或许对您有用:
- [已解决] 5 ArrayList或者HashTable支持序列化和反序列化吗? 2010/9/9 23:12:41
- [已解决] 5 JSON.Net的SerializeObject可以处理List数据吗? 2010/9/9 23:05:22
- [已解决] 10 在VS2010中装Silverlight tools 4出错 2010/8/13 8:40:43
- [已解决] 5 C#中如何取余数? 2010/8/3 18:39:49
- [已解决] 10 C#中委托能不能序列化?WCF中需要传递委托! 2010/7/31 11:09:43