G
Guest
Hi ALL
I have create ArrayList Object, I want to loop to remove someitem in the
ArrayList.
However, it pops me exception.
The example is
foreach(string s in arraylist){
if(s.Equals("test"))
arraylist.Remove(s);
}
when it removes one item and do the next loop, it will pops me up an
exception:
"Collection was modified; enumeration operation may not execute."
I have googled, and the solution is from last to the first?
Does it sound silly?
Thanks
I have create ArrayList Object, I want to loop to remove someitem in the
ArrayList.
However, it pops me exception.
The example is
foreach(string s in arraylist){
if(s.Equals("test"))
arraylist.Remove(s);
}
when it removes one item and do the next loop, it will pops me up an
exception:
"Collection was modified; enumeration operation may not execute."
I have googled, and the solution is from last to the first?
Does it sound silly?
Thanks