but when you remove an item from the collection/arraylist, doesn't that change the indexing?
-----Original Message----- From: Chris Anderson [mailto:[EMAIL PROTECTED]] Sent: Monday, June 10, 2002 10:08 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] enumerating a collection while adding more items to it Alternatively don't use foreach, loop through using one of the other loop syntaxes, and decide what you want to do with the index variable you are using when you add/delete items Merak > -----Original Message----- > From: franklin gray [mailto:[EMAIL PROTECTED]] > Sent: 10 June 2002 15:49 > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] enumerating a collection while adding > more items to it > > > What I have done in the past when deleting is load the > objects into a seperate collection, then perform the action > when done enumerating. What I did was for deleting but I am > sure the same approach will work for adding new objects > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.