首页 新闻 会员 周边

一个List<T>调用ToList()的时候报错,该怎么办

0
[已解决问题] 解决于 2015-07-21 10:30

System.ArgumentException: 目标数组的长度不够。请检查 destIndex 和长度以及数组的下限。
在 System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
在 System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
在 System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex)
在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

拖鞋王子的主页 拖鞋王子 | 初学一级 | 园豆:37
提问于:2015-07-20 11:11
< >
分享
最佳答案
0

没有看到你的代码,不知道什么问题,猜测下应该是线程的问题,不然不可能报错,List<p>是线程不完全的,ToList也是线程不完全的,你去加个锁看看,同步下操作看看

奖励园豆:5
稳稳的河 | 老鸟四级 |园豆:4216 | 2015-07-21 10:29
其他回答(1)
0

tolist有参数吗?

吴瑞祥 | 园豆:29449 (高人七级) | 2015-07-20 11:17

没有

支持(0) 反对(0) 拖鞋王子 | 园豆:37 (初学一级) | 2015-07-20 11:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册