What is the difference between IList and List?
- A List is a concrete class that represents a collection of objects or values of the defined type.
- It can be used as a dynamic array where the individual elements can be accessed over an index and the collection can be iterated as a whole.
- An IList is an interface, that is implemented by the List class.
- An IList is used when a component is developed to be exposed to the outside that takes in a collection of objects or returns a collection of objects, as a design best practice.
- Both the IList and List implement the IEnumerable interface.
Posted Mar 25, 2021