Collection was modified error when looping through list and removing items <p>I have the following:</p> <pre><code> tempLabID = lstLab; foreach (string labID in lstLab) { if (fr.GetFileRecipients(fsID).Contains(labID)) { tempLabID.Remove(labID); } } </code></pre> <p>When I debug and watch lstLab and I get to tempLabID.remove() it changes lstLab to 0 from 1, and then in turn, when it gets back to the foreach I get an error saying the collection has been modified.</p> <p>I can't understand why it's happening. I am modifying a different collection.</p>