方法传入集合List<string> ids;
执行操作后再次循环引发异常
foreach (string id in ids)
{ ids.Add("a"); }更改为for循环可控制循环次数
int ic = ids.Count();
for (int j = 0; j < ic; j++) {//验证判断
//if(true)
//{
//ids.Remove(ids[j]);
//}
}
本文共 251 字,大约阅读时间需要 1 分钟。
方法传入集合List<string> ids;
执行操作后再次循环引发异常
foreach (string id in ids)
{ ids.Add("a"); }更改为for循环可控制循环次数
int ic = ids.Count();
for (int j = 0; j < ic; j++) {//验证判断
//if(true)
//{
//ids.Remove(ids[j]);
//}
}
转载于:https://www.cnblogs.com/Tangcy/p/4924069.html