title: Is it possible to implement RemoveAll() on EntityCollection<T>?
body: <p>I have a question similar to <a href="https://stackoverflow.com/questions/207038/best-way-to-remove-items-from-a-collection">this one</a>, but pertaining to <code>EntityCollection&lt;&gt;</code>.</p>
  
  <p><code>EntityCollection</code> implements <code>Remove()</code>, allowing you to remove a <em>single</em> item from the list at once.  However, I'd like to implement an extension method that can remove multiple items at once, similar to <code>IList&lt;T&gt;</code>'s <code>RemoveAll(Predicate&lt;T&gt; match)</code> method.</p>
  
  <p>One idea would be to loop through the list, and remove items.  Something like:</p>
  
  <pre><code>public static void RemoveAll&lt;T&gt;(this EntityCollection&lt;T&gt; collection, Predicate&lt;T&gt; match) where T : EntityObject
  {
     foreach (T o in collection)
     {
        if (match(o))
           collection.Remove(o);
     }
  }
  </code></pre>
  
  <p>However, this will throw an exception because you can't modify the collection you're iterating through.</p>
  
  <p>Another idea would be to build a temporary list of items to remove, then loop through <em>that</em> list and remove each item from the collection.  However, this seems inefficient to me.  Is there a better implementation?</p>