What should I use an IEnumerable or IList? [duplicate]

Generally speaking, you should try and use the least specific type that suits your purpose. IEnumerable is less specific than IList (IList implements IEnumerable) so unless you want something specific from IList (such as Count as you suggest, or perhaps Add, Delete, etc), I’d use IEnumerable. One benefit of remaining with IEnumerable is that you … Read more