4 ms·
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
by Aaronontheweb 16y ago
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?
- euroclydon 16y agoYeah, 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?