News for hackers. Stuff that matters.
Re:Arrays considered somewhat harmful by Aaronontheweb on Monday January 24, 2011 @04:34PM (#2136859)
As a general practice it's bad to return List<T> for that reason - it's bloated with additional members and state to match to support just-about-anything out of the box.

Return IList instead of List on any public interface you define is the rule I try to obey.

Basically it's all about how you implement arrays in your called classes - do they expose some internal state by returning a deep clone of the array each time it's called (which is what the examples Eric used were doing) or does it expose its contents via a read-only List?

Re:Arrays considered somewhat harmful by euroclydon on Monday January 24, 2011 @08:23PM (#2137561)
Yeah, but which hard class do you return as an IList? Does the bloat go away if you return a List from an IList typed method?