Chuck,
Are you removing the item while you are enumerating through it? If so,
then this is not allowed. You need to cycle through the object using the
indexer, or whatever other access method there is to get an item from the
object.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"Chuck Bowling" <(E-Mail Removed)> wrote in message
news:%23PDtL$(E-Mail Removed)...
>I have a collection that I want to edit. When I remove an object from the
>collection and then try to enumerate thru it with the foreach statement it
>throws an exception - "Collection was modified; enumeration operation may
>not execute."
>
> Can somebody tell me how to fix this?
>
>