Re: Array vs List<>
Chris Anderson <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
> On the one it is the main reason why I don't tend to use IEnumerable<T> > - I've had too many experiences where I've started using it, and then > had to backtrack because I've subsequently found I needed indexed > access (I think the most common reasons are that (a) I need to set up a > parallel array with some related data about each element of the > original array, and so need the index to map between the arrays, or (b) > I need the index purely for debugging - so that if an error occurs > while working through the list, I can instantly tell which element of > the list is causing the error); FWIW that smells a lot of an incomplete object model. If the objects in the array/list were design-complete, you wouldn't need to attribute additional data in a parallel array/list. You would also be able to tell which element is causing the error - by looking at the element itself Chris =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives