← Back to list

Small Interview Question, Big Impact: The Difference Between IEnumerable<T> and List<T>

In .NET interviews, very basic questions are often asked, such as:

Code Crack in Dot Net, API & SQL Learning · 2026-07-08 03:24 · 2 claps · 1.1 min read paywalled
#lists #enumarable #loop #dotnet #csharp
Open on Medium ↗

Small Interview Question, Big Impact: The Difference Between IEnumerable<T> and List<T>

Difference Between IEnumerable<T> and List<T> (Photo — ChatGPT)

Difference Between IEnumerable<T> and List<T> (Photo — ChatGPT)

In .NET interviews, very basic questions are often asked, such as:

“What is the difference between IEnumerable<T> and List<T>?”

Although the question may seem simple, the way you answer it can demonstrate how clear your understanding of C# fundamentals is.

IEnumerable<T>’ is essentially an interface that allows for iteration over a collection, one element at a time. It is typically used to read or traverse data using a ‘foreach’ loop.

On the other hand, ‘List<T>’ is a concrete collection class. It allows for data storage and enables the modification of the collection using methods such as ‘Add()’, ‘Remove()’, ‘Insert()’, and ‘Sort()’.

Simply put:

  • If you only want to read or iterate over data → IEnumerable<T>
  • If you want to add, remove, update, or access data by index → ​​List<T>

An important point is that List<T> itself implements IEnumerable<T>. Therefore, it is possible to return a List<T> as an IEnumerable<T>.

It is generally used to access data via a foreach loop.

IEnumerable<int> numbers = new List<int> { 10, 20, 30, 40 }; 
foreach (int number in numbers) 
{ 
    Console.WriteLine(number); 
}

In an interview, simply stating the definition might make your answer technically correct. However, if you can also explain aspects like use cases, flexibility, and abstraction, your answer will be much stronger.

This is because, in interviews, even a simple, basic question can provide significant insight into your fundamental knowledge.


메타데이터
post_id
bfde2e4615c2
slug
small-interview-question-big-impact-the-difference-between-ienumerable-t-and-list-t-bfde2e4615c2
url
https://medium.com/dot-net-sql-learning/small-interview-question-big-impact-the-difference-between-ienumerable-t-and-list-t-bfde2e4615c2
canonical_url
https://medium.com/dot-net-sql-learning/small-interview-question-big-impact-the-difference-between-ienumerable-t-and-list-t-bfde2e4615c2
author_url
https://medium.com/@CodeCrack
status
ok
fetched_at
2026-07-08 16:17:31