阅读背景:

如何在C#中迭代可枚举集合中的项目时修改或删除它们

来源:互联网 

I have to delete some rows from a data table. I've heard that it is not ok to change a collection while iterating through it. So instead of a for loop in which I check if a row meets the demands for deletion and then mark it as deleted, I should first iterate through the data table and add all of the rows in a list, then iterate through the list and mark the rows for deletions. What are the reasons for this, and what alternatives do I have (instead of using the rows list I mean)?.I have to delete some rows from a data table. I




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: