I have a third-party api that has a class that returns an enumerator for different elements in the class.
I need to delete an item in this enumerator, so I cannot use "for each". The only option I can think of is to get an account, iterate over the listing, and then start a normal loop to remove the items.
Does anyone know how to avoid two loops?
thank
[update] sorry for the confusion, but Andrew is lower in the comments right.
Here is some kind of pseudo code from my head that will not work and for which I am looking for a solution that will not include two cycles, but I think this is impossible:
for each (myProperty in MyProperty)
{
if (checking some criteria here)
MyProperty.Remove(myProperty)
}
MyProperty is a third-party class that implements an enumerator and a delete method.