W3Teacher
  • Explore
    Browse by field
    Artificial Intelligence Accounting & Finance Information Technology
    Show all fields
  • Interview Q&A
    • All Interview Questions
    • Beginner
    • Intermediate
    • Advanced
  • Practice
    • MCQs
    • Quizzes
    • Mock Interviews
  • About
  • Sign in
  • Get Started
  1. Home
  2. C#
  3. Collections
  4. Question
All 16 Collections questions
More in Collections
When would you use a List<T> vs an array? When should you use a Dictionary<TKey,TValue>? What is the difference between List<T> and an array (T[]) in terms of resizing? What is the difference between Dictionary<TKey, TValue> and List<T> in terms of lookup performance? What does HashSet<T> provide and when do you use it? When would you choose a HashSet<T> over a List<T>, and what guarantee does it provide? How does Queue<T> differ from Stack<T> in terms of the order items are removed? What is the difference between IEnumerable<T>, ICollection<T>, and IList<T> in the collection interface hierarchy? When would you reach for a ConcurrentDictionary or an immutable collection? How do you avoid multiple enumeration of an IEnumerable?
Advertisement
C# › Collections

What is the difference between IEnumerable, ICollection and IList?

Intermediate

Answer

IEnumerable supports iteration only; ICollection adds Count/Add/Remove; IList adds indexed access and Insert. Accept the least specific type your method needs.
void Print(IEnumerable<int> xs) {}
int First(IList<int> xs) => xs[0];
Real-world example Accepting IEnumerable<T> in APIs keeps callers flexible (arrays, lists, LINQ).
Previous question What is the difference between Dictionary<TKey, TValue> and List<T> in terms of lookup performance? Next question What does HashSet<T> provide and when do you use it?
All 16 Collections questions
W3Teacher

Learn technologies. Ace technical interviews.


    Learn
    • Technologies
    • Tutorials
    • Interview Questions
    • MCQs
    Practice
    • Quizzes
    • Mock Interviews
    • Bookmarks
    • Dashboard
    Get the latest questions & tips

    Fresh interview questions and practice tips, straight to your inbox.

    Company
    • About
    • Contact us
    • Privacy Policy
    • Terms & Conditions

    © 2026 W3Teacher. All rights reserved.