InvalidOperationException on modifying List<T> during foreach enumeration
Problem Context When a structural change is made to a List inside a foreach loop, the runtime throws an InvalidOperationException. The exception message indicates that the collection was modified during enumeration. Goal Identify the precise performance cost of the enumerator’s version check and evaluate whether a zero‑allocation safe iteration helper would