Why should I use List<T> over IEnumerable<T>?
- by Rowan Freeman
In my ASP.net MVC4 web application I use IEnumerables, trying to follow the mantra to program to the interface, not the implementation.
Return IEnumerable(Of Student)
vs
Return New List(Of Student)
People are telling me to use List and not IEnumerable, because lists force the query to be executed and IEumerable does not.
Is this really best practice? Is there any alternative? I feel strange using concrete objects where an interface could be used. Is my strange feeling justified?