You should always accept the least restrictive parameter types.
This means IEnumerable<T> , ICollection<T> or IList<T> .
Thus, the client can pass any kind of implementation, for example, an array, HashSet<T> or ReadOnlyCollection<T> .
In particular, you should take IEnumerable<T> if you only need to iterate over the data, ICollection<T> if you also want to add or remove elements, or if you need to know the size, and IList<T> if you need random access (index).
source share