I have a queue carrying class objects.Each class object has 3 string properties.In a loop i am checking with an If condition, on one of the class properties and on that basis i want to remove(dequeue) an object.
Suppose in c#.net and some pseudo code following is the scenario.
Foreach Loop to iterate through queue items
if myClassObj==(int)Class.Property1.ToString()
{
queue.Dequeue(this)
}
EndLoop
I get an exception saying that "Collection was modified after the enumerator was instantiated." Any one got idea about this? and also any alternates are welcome.Cheers
Loading
knightsPosted Dec 9, 2010, 2:01 PM
Subhendu DePosted Dec 9, 2010, 11:25 AM
http://stackoverflow.com/questions/2214446/how-can-i-modify-a-queue-collection-in-a-loop
If problem doesn't solve, ping me again.
Thanks.....