Tag Archives: Collection was modified; enumeration operation may not execute

Behaviour when deleting list items in a sharepoint list

Sometimes I get amazed by the way SharePoint works. This short article shows a perfect example of strange behaviour when you want to delete a listitem from a list using loops. I found it because the same exception as mentioned in the article (“Collection was modified; enumeration operation may not execute”) appeared when I tried to delete SharePoint groups programmatically.

You can find the article here.

The article of course gives an explanation as well as the correct way to perform the task.

Edit: Ok, it’s not that strange now that I come to think of it. =P