title: Why am I getting "Collection was modified; enumeration operation may not execute" when not modifying the enumerated collection?
body: <p>I have two collections of strings: CollectionA is a StringCollection property of an object stored in the system, while CollectionB is a List generated at runtime. CollectionA needs to be updated to match CollectionB if there are any differences. So I devised what I expected to be a simple LINQ method to perform the removal.</p>
  
  <pre><code>var strDifferences = CollectionA.Where(foo =&gt; !CollectionB.Contains(foo));
  foreach (var strVar in strDifferences) { CollectionA.Remove(strVar); }
  </code></pre>
  
  <p>But I am getting a <code>"Collection was modified; enumeration operation may not execute"</code> error on strDifferences... even though it is a separate enumerable from the collection being modified! I originally devised this <em>explicitly</em> to evade this error, as my first implementation would produce it (as I was enumerating across <code>CollectionA</code> and just removing when <code>!CollectionB.Contains(str)</code>). Can anyone shed some insight into why this enumeration is failing?</p>