Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Participant
1760 Points
330 Posts
Feb 29, 2012 11:03 AM|LINK
Try to never remove anything from a collection you're iterating over while you're inside a loop. except if you're using while or
iterate through the list backwards..
for (int x = yourList.Count - 1; x >= 0; x--) { if ("عمل صالح") yourList.RemoveAt(x); }
Nazm
Participant
1760 Points
330 Posts
Re: List<Type> Remove
Feb 29, 2012 11:03 AM|LINK
Try to never remove anything from a collection you're iterating over while you're inside a loop. except if you're using while or
iterate through the list backwards..
for (int x = yourList.Count - 1; x >= 0; x--) { if ("عمل صالح") yourList.RemoveAt(x); }