What is the best way to modify a list in a ‘foreach’ loop?
The collection used in foreach is immutable. This is very much by design. As it says on MSDN: The foreach statement is used to iterate through the collection to get the information that you want, but can not be used to add or remove items from the source collection to avoid unpredictable side effects. If … Read more