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.
  • 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.
Sriram Mannava
Sriram Mannava

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity.

Leave a Reply

Your email address will not be published. Required fields are marked *