Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
1.18/5 (3 votes)
See more:
hi all

Can any one please tell me what does this exception means


"Collection was modified; enumeration operation may not execute."


Thanks
Posted
Comments
Ankur\m/ 28-Jun-13 6:28am    
Google for it and you will get lots of links explaining it. Do learn to use search engines, they are your friend!
babli3 28-Jun-13 6:40am    
Thank you

Why being so lazy? I searched with your subject in Google[^] and I found About 1,160,000 results (0.20 seconds).


[Edit]Added definition[/Edit]

This error occurs when you are performing a foreach loop over a generic list or a collection and there is a line of code inside the loop that is trying to modify the contents of the list.

--Amit
 
Share this answer
 
v2
Comments
babli3 28-Jun-13 6:36am    
hi I did google it but couldnt actually understand as i am a fresher. So thought someone from this blog can give me better view. Thanks
_Amy 28-Jun-13 6:40am    
See my updated answer. Better show your code so that I can explain the situation.
babli3 28-Jun-13 6:41am    
Ok thank you
Nirav Prabtani 28-Jun-13 6:37am    
Plese mention it as a comment this is not a solution.
_Amy 28-Jun-13 6:40am    
It's a full solution. Do you agree now? ;)
Question is not complete ..
I think you are trying to change the values in the collection while looping/iterating the same collection by iterating statements...
 
Share this answer
 
Comments
Sushil Mate 28-Jun-13 6:34am    
This is not solution. Please try the comment section, Exact below to this question.
 
Share this answer
 
Comments
babli3 28-Jun-13 6:40am    
Thank you
Shafeequl 29-Jun-13 4:37am    
welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900