Re: Newbie - delete item from collection
Peter Vertes <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
Yes it needs to be re-evaluated each and every iteration of the loop otherwise you would not know the exact number of elements inside the collection at the moment of iteration. -Pete On Mon, Nov 17, 2008 at 5:06 PM, Geoff Taylor <[email protected]>wrote: > Really? I thought that was cached before the first iteration of the loop > and not re-evaluated. Does it really evaluated Count each time through the > loop? > > Geoff > > > On 17 Nov 2008, at 21:04, Chris Anderson <[email protected]> wrote: > > (I'd also have expected it to throw an exception towards the end, >>> because >>> there are no longer _someList.Count items in the list.) >>> >> >> Yes there are ;-) >> _someList.Count will be decrementing as you remove items >> >> =================================== >> View archives and manage your subscription(s) at >> http://peach.ease.lsoft.com/archives >> > > =================================== > View archives and manage your subscription(s) at > http://peach.ease.lsoft.com/archives > =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives