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
The reason you see this is The IEnumerator returned by the underlying collection may expose the current property as read-only. Generally, you should avoid changes to collections(in fact most cases you will not even be able to change the collection) using for-each.