Delete objects in recursive

If I delete objects in recursive like:

//Code in GraphView.cs
foreach(GoObject o in this.Document)
{
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
if(o is demainded a condition)
{
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
this.Document.Remove(o);</BLOCKQUOTE>
}
//There some demainded objects wasn't deleted.</BLOCKQUOTE>
}

If put the code in more a loop It’s OK
Tell me the optimized code.

GoDocument implements IGoCollection which implements IEnumerator. As the .NET documentation clearly states:
Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection.
So if you want to remove objects from an IGoCollection, you should do something like:
foreach (GoObject obj in this.Document.CopyArray()) {
if (… obj …) obj.Remove();
}

thanks