Kevin RansomDeveloping the Peer ChannelAlgorithms and .Net collections- March 14, 2005 Algorithms and .Net collectionsRecently I was asked by a colleague about an InvalidOperation exception with the message:Collection was modified; enumeration operation may not execute.It would seem that my colleague like many of us expected code similar to this to workforeach (Item s in collection) if (s.expired == true) collection.Remove(s); And yet it gave an Invalid operation exception with the...http://blogs.msdn.com/kevin_ransom/archive/2005/03/14/395101.aspx |