0

Can anyone elaborate on IList and ICollection. And also, When and where do we use IList or ICollection

1 Answers1

9

IList implements ICollection and IEnumerable. In addition it provides method definitions for adding and removing elements and to clear the collection. It also provides methods for handling the positioning of the elements within the collection. It also provides an object indexer to allow the user to access the collection with square brackets like:

myList[elementIndex]

enter image description here

reference: Claudio Bernasconi's article about IList and ICollection

Sebastian 506563
  • 6,980
  • 3
  • 31
  • 56