Posts

Showing posts from April, 2023

IList vs ICollection vs IEnumerable

Image
https://www.linkedin.com/pulse/ienumerable-vs-icollection-idictionary-ilist-hasan-shahjahan/ What are IList, ICollection, and IEnumerable? Before we dive into the differences between these interfaces, let's first define what they are and what they do. IList: The IList interface is used to represent a collection of items that can be accessed by index. It is a more specific version of the ICollection interface, which means that it has all the same functionality as ICollection but with additional features that allow you to access items by their index in the list. ICollection: The ICollection interface is used to represent a collection of items that can be modified. It provides functionality for adding, removing, and counting items in the collection. IEnumerable:  The IEnumerable interface is used to represent a collection of items that can be iterated over. It provides functionality for iterating over the items in the collection but does not provide any functionality for modifying the...