title: InvalidOperationException was unhandled - why?
body: <p>First of all, at the beginning of my code I declare an ArrayList <code>public ArrayList ArrivalsInApp = new ArrayList();</code>. Then, much  much later, I am downloading some data from XML file. For each XmlNode called "flight" I am creating a Panel. </p>
  
  <p>While creating the Panel, I add its name into the <code>ArrivalsInApp</code> ArrayList. The generating of the panel is in a method. The method has several foreach cycles and IF conditions. Technically, all it does it decides if Panel should be created (if its in XML and not in app), updated (in in both) or deleted (in app but not in XML).</p>
  
  <p>In the method, I get names of all flights in XML, save into ArrayList. Now using foreach, I check if all flights in the application (so in the ArrivalsInApp ArrayList) are ALSO in the XML. I do this using this code:</p>
  
  <pre><code>foreach (string y in ArrivalsInApp)
  {
  if (XmlArrivals.Contains(y) == false)
  {
  *code*
  }
  }
  </code></pre>
  
  <p>The "deciding" method is called on form1_load, and every 30 second using a Timer. When the timer reaches specified value, I reload the XML and then call the method. But, I get an InvalidOperationException with comment that "Collection was modified; enumeration operation may not execute." at line <code>foreach (string y in ArrivalsInApp)</code>. I am totally desperate, I have no Idea what causes this.</p>
  
  <p>What happens if I run the .exe file (if I just debug it, after the timer reaches the value, the program shuts down and shows this error) is, that the Panel is deleted regardless if it should be updated or deleted, and the unhandled exception error pops up.
  Sorry if the explanation is a bit confused. If anyone would like me to post the whole source file (maybe rather the whole project) just let me know. However, since it has now about 1800 lines of code, it would need quite a lot of explanation.</p>