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?
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?