Hacker News new | past | comments | ask | show | jobs | submit login

In C#:

IList<T>: implemented by List<T> and T[] (arrays)

ISet<T>: implemented by HashSet<T> and SortedSet<T>

IDictionary<T,U>: implemented by Dictionary<T,U>

all implement ICollection<T> and IEnumerable<T>. In the case of dictionary, it implements ICollection<KeyValuePair<T,U>>, IEnumerable<T> (.Keys) and IEnumerable<U> (.Values), etc

It's all basically the same thing. Organized and unified.

IList<T> is actually implemented by a lot of things, and the more general you go, the more things implement it. IEnumerable just allows you to get an iterator that will go through the elements. ICollection adds the ability to add and remove elements. IList further adds indexed access and order. The generic collections and operations on them are one of the best aspects of C# and the standard lib.




Thank you for your correction! I am still suspicious that there is some forgotten weirdness lurking in there, but I'm glad someone didn't let me propagate my mistaken recollections unanswered. :-)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: