title: Efficiently deleting item from within 'foreach'
body: <p>For now, the best I could think of is:</p>
  
  <pre><code>bool oneMoreTime = true;
  while (oneMoreTime)
  {
      ItemType toDelete=null;
      oneMoreTime=false;
      foreach (ItemType item in collection)
      {
          if (ShouldBeDeleted(item))
          {
              toDelete=item;
              break;
          }
      }
      if (toDelete!=null)
      {
          collection.Remove(toDelete);
          oneMoreTime=true;
      }
  }
  </code></pre>
  
  <p>I know that I have at least one extra variable here, but I included it to improve the readability of the algorithm.</p>