title: Entity Framework 4 Delete Object from entity collection
body: <p>I have a "Request" Entity with an 1..* relationship to the "RequestProperty" Entity. So there's a collection of RequestProperty objects in "Request". When I update a "Request" I want to delete all items in the RequestProperty EntityCollection and add the new items from the incoming domain object. When I iterate over the <code>Request.Properties</code> collection and call a remove or a <code>DeleteObject</code> on the item, the enumeration fails because the collection has been modified.</p>
  
  <p>As of now I'm doing this:</p>
  
  <pre><code>while (true)
  {
      if (newRequest.Properties.Count &gt; 0)
          context.RequestPropertySet.DeleteObject(newRequest.Properties.First());
      else
          break;
  }
  </code></pre>
  
  <p>Since this is not really "cool" I thought there must be another way to empty a collection of a relationship. Thank you for your thoughts.</p>