The reason is that using a specific List<T> intended to detail the implementation, and you have to show something more abstract, like IEnumerable<T> or ICollection<T> , which represents only the functionality that you want to expose (e.g. enumerated , mutable and / or indexed). This gives you the flexibility to further change your implementation.
In practice, this warning is often resolved by returning IList<T> instead of List<T> , but the idea is to encourage you to think about "what kind of functionality do I really need to ensure that my subscribers?" For instance. maybe I should return IEnumerable<T> or ReadOnlyCollection<T> because I do not want my callers to mess around with the returned collection.
source share