Showing posts with label foreach. Show all posts
Showing posts with label foreach. Show all posts

Wednesday, 21 September 2016

Exception: The collection was modified. Enumeration operation may not execute.


Change

foreach(Object x in ObjectCollection) {...}

to

foreach(Object x in ObjectCollection.ToList()) {...}