title: Why this code throws 'Collection was modified', but when I iterate something before it, it doesn't?
body: <pre><code>var ints = new List&lt; int &gt;( new[ ] {
      1,
      2,
      3,
      4,
      5
  } );
  var first = true;
  foreach( var v in ints ) {
      if ( first ) {
          for ( long i = 0 ; i &lt; int.MaxValue ; ++i ) { //&lt;-- The thing I iterate
              ints.Add( 1 );
              ints.RemoveAt( ints.Count - 1 );
          }
          ints.Add( 6 );
          ints.Add( 7 );
      }
      Console.WriteLine( v );
      first = false;
  }
  </code></pre>
  
  <p>If you comment out the inner <code>for</code> loop, it throws, it's obviously because we did changes to the collection.</p>
  
  <p>Now if you uncomment it, why this loop allow us to add those two items? It takes awhile to run it like half a minute (On Pentium CPU), but it doesn't throw, and the funny thing is that it outputs: </p>
  
  <p><a href="https://i.stack.imgur.com/sUN4l.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sUN4l.png" alt="Image"></a></p>
  
  <p>It was a bit of expected, but it indicates that we can change and it actually changes the collection. Any ideas why this behaviour occuring?</p>