c# - How to iterate through a list that is being modified? -
I have a list of rows from the dataset that I need to be repeated.
The problem is that the processing list can remove one or more rows from the list.
Since the list is being modified, I can not use any foreach () loop.
But since then it may possibly happen in some extinction elements before I am processing, even I can not use the loop (i.e., if I am processing element, And as a result of the extinction of the element and other elements, the way I was processing, I can not think of a way to adjust the element correctly to indicate.)
How to deal with the problem Will you? My current idea is to always process the first element in the list if it is removed, then process the new first element if it is not removed, then to move it to the "already processed" list, Process the first element.
Is there any easy way?
When I am modifying a list, since then I always have a I am able to create a new list that I want to keep, and then the new
it really depends on the data you have made, I think.
Comments
Post a Comment