Collection enumeration exception

From: Chuck Bowling (chuckbowling_at_sbcglobal-NO-SPAM.net)
Date: 03/15/05


Date: Tue, 15 Mar 2005 11:59:49 -0500

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?



Relevant Pages

  • Re: Find key by value
    ... Even if we fix the spelling error, that's not a very efficient way to perform the search. ... Much better to just enumerate the KeyValuePair<TKey, TValue> instances in the Dictionary, examining the Value property of each. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Windows XP not using custom form
    ... If you are not familiar with enumerate, ... The app should display the form you defined in it's page setup. ... If I cannot find a fix I will have to put in the ... Is there a way to use 98 print drivers in XP? ...
    (microsoft.public.windowsxp.print_fax)
  • dump add/remove programs list
    ... i need a quick fix or i would work on this myself but im hoping someone has already done it. ... i need to enumerate through all sub keys in: ... i need to do this on remote machines so wmi im guessing... ...
    (microsoft.public.scripting.vbscript)
  • Re: Having trouble installing IEEE1394 Controller
    ... FIX: Inconsistent gap count can cause 1394 devices to not enumerate ... Good luck ...
    (microsoft.public.windowsxp.help_and_support)

Loading