[Exception] Collection was modified; enumeration operation may not execute

Solution : replace for each loop to standard loop

 


ArrayList items = new ArrayList();

//foreach (var item in items)
//{
// //do something
//}

for (int i = 0; i < items.Count; i++)
{
//do something
}


Referece: http://alitarhini.wordpress.com/2011/04/06/collection-was-modified-enumeration-operation-may-not-execute/

沒有留言:

張貼留言