I keep hearing that in .net 3.5 you should use IEnumerable over a List, but I can’t find any reference materials or articles that explain why it’s so much more proficient. Does
One reason that it is recommended to have methods return IEnumerable
is that it is less specific than List
. This means that you can later change the internals of your method to use something that may be more efficient for the needs of it, and as long as it is an IEnumerable
you don't need to touch the contract of your method.