Mid From PDF MNC Coding C# MNC Coding Interview

IEnumerable vs ICollection vs IList?

IEnumerable vs ICollection vs IList

What interviewers test

  • Execution pipeline understanding
  • Abstraction knowledge

Hierarchy

IEnumerable

└── ICollection

└── IList

IEnumerable<T>

  • Read-only iteration
  • Lazy execution
IEnumerable<int> numbers = GetNumbers();
foreach (var n in numbers) { }

✅ Best for streaming, read-only, deferred execution

ICollection<T>

  • Adds count + add/remove
ICollection<int> list = new List<int>();
list.Add(1);

✅ When modifying collection without index access

IList<T>

  • Index-based access
IList<int> list = new List<int>();
int first = list[0];

✅ When order & index matter

Interview rule of thumb

“Expose the least powerful interface required.”

More from C# Programming Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details