title: C# CheckedListBox InvalidOperationException on a foreach loop
body: <p>I Don't know what I'm doing wrong but I keep getting this error. Does anyone know what could be causing this?</p>
  
  <p>InvalidOperationException 
  List that this enumerator is bound to has been modified. 
  An enumerator can only be used if the list does not change.</p>
  
  <pre><code>    public static string[] WRD = new string[] {"One","Two","Three","Four"}
  
      public static string[] SYM = new string[] {"1","2","3","4"}
  
      //this is how I'm populating the CheckedListBox
      private void TMSelectionCombo_SelectedIndexChanged(object sender, EventArgs e)
      {
          TMSelection.Items.Clear();
          switch (TMSelectionCombo.SelectedItem.ToString())
          {
              case "Words":
                  foreach (string s in WRD)
                  {
                      TMSelection.Items.Add(s);
                  }
                  break;
              case "Symbols":
                  foreach (string s in SYM)
                  {
                      TMSelection.Items.Add(s);
                  }
                  break;
          }
      }
  
      //this is where the problem is
      private void AddTMs_Click(object sender, EventArgs e)
      {
          //on this first foreach the error is poping up
          foreach (Object Obj in TMSelection.CheckedItems)
          {
              bool add = true;
              foreach (Object Obj2 in SelectedTMs.Items)
              {
                  if (Obj == Obj2)
                      add = false;
              }
              if (add == true)
                  TMSelection.Items.Add(Obj);
          }
      }
  </code></pre>