I\'ve seen this question posted here previously but I\'m not satisfied that I understand the complete ramifications. The problem is what return type should a data layer that
Collections are not generally very useful for DAL returns, because a collection does not implicitly guarantee order. It's just a bucket of items. An IList, on the other hand, does implicitly guarantee order. So we're down to IEnumerable or IList. The next question would be: is the List object "live"? i.e., is it connected to the data backing so that when you add an item to the IList, it will be reflected in the DB? For LINQ-to-SQL, this is not the case. Rather, you're supposed to attach entities to the tables. So unless you supply this additional wiring, a List is superfluous. Stick with IEnumerable.
You should always return an interface rather than a concrete type, this goes without saying as it specifies the behaviour allowed without tying the consumer to a specific implementation.
In terms of which interface to return, you should think about the purpose of the method and the intentions of the caller. If you return a collection, should the caller be able to alter the collection? e.g. add/remove items? if all they need to do is enumerate it (do a foreach) then you should just return an IEnumerable.
1) It's best to return an IList so that the results can be put into any object that implements that interface, rather than forcing the caller into using a List. For example, the caller might wish to have the results returned to an ArrayList, this wouldn't be possible if you had the results returned to a List. ArrayList doesn't inherit from List, but it does implement IList.