Avoid Collection has been modified error
问题 Issue: I have the following code: foreach(var ItemA in GenericListInstanceB) { ItemA.MethodThatCouldRemoveAnyItemInGenericListInstanceB(); } Obviously i get an error. What i want to do is change GenericListInstanceB to a class i create, that keeps track of items it should remove. Then, when the loop is finished, it removes them all. Same with adding items. This is fine, i can create a class that has an internal list, and a list of items to add and items to remove. Then another method called