Collection was modified where items are not being modified
<p>I am developing a simple game with the XNA library for C#. In the following code snippet I am getting the</p>

<blockquote>
  <p>Collection was modified; enumeration operation may not execute. </p>
</blockquote>

<p>error at the top of the second foreach loop. In my (relatively limited) experience of C# this occurs when attempting to modify the underlying collection during a loop. However, as far as I can see I am not modifying the enemy_positions collection in any way. All the collections in this code are of the type <code>List&lt;Vector2&gt;</code>.</p>

<p>What is happening here?</p>

<pre><code>//defines collision behaviour when enemy is hit
int be_no = 0;
List&lt;Vector2&gt; tmp_bullets = bullet_i_position;
List&lt;Vector2&gt; tmp_enemy = enemy_positions;

foreach (Vector2 bullet in bullet_i_position)
{
    //get bullet collision box
    Rectangle bullet_col = new Rectangle(Convert.ToInt32(bullet.X - 12), Convert.ToInt32(bullet.Y - 12), 25, 26);

    int en_no = 0;

    foreach (Vector2 enemy in enemy_positions)
    {
        //get enemy collsion box
        en_box = new Rectangle(Convert.ToInt32(enemy.X), Convert.ToInt32(enemy.Y), 75, 75);

        if (temp_r.Intersects(en_box))
        {
            //remove all colliding elements
            tmp_enemy.RemoveAt(en_no);
            tmp_bullets.RemoveAt(be_no);
            bullet_direction.RemoveAt(be_no);

        }
        en_no++;
    }
    be_no++;
}

//update actual lists
bullet_i_position = tmp_bullets;
enemy_positions = tmp_enemy;
</code></pre>
