What is the real advantage of returning ICollection<T> instead of a List<T>? [duplicate]
问题 This question already has answers here : Closed 10 years ago . I've read a couple of blog post mentioning that for public APIs we should always return ICollection (or IEnumerable) instead of List. What is the real advantage of returning ICollection instead of a List? Thanks! Duplicate: What is the difference between List (of T) and Collection(of T)? 回答1: An enumerator only returns one entity at a time as you iterate over it. This is because it uses a yield return . A collection, on the other