I\'m enumerating over a collection that implements IList, and during the enumeration I am modifying the collection. I get the error, \"Collection was modified; enumeration
This is the specified behavior:
Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.
This limitation makes enumerators simpler to implement.
Note that some collections will (incorrectly) allow you to enumerate while modifying the collection.