发布时间:2020-07-20 18:16:44来源:本站阅读(1039)
今天在使用foreach循环遍历list集合时,出现Collection was modified; enumeration operation may not execute.这个错误,查了半天才发现是当想要修改list集合时,不能使用foreach,因为foreach是取只读的,在取的时候数据不能变(包括修改,删除,添加等),所以只能用for循环。
关键字:
上一篇: EF CORE使用HasColumnType配置字段类型
下一篇: C#静态类与静态方法
1289
823
743
1514
1482
1333
1439
1409
795
1289
9178
5753
5265
4887
4329
4042
3169
3092
3087
3046