juniorLINQ

Difference between IEnumerable and IQueryable

Updated May 16, 2026

Short answer

IEnumerable works in-memory; IQueryable builds expression trees for remote execution like databases.

Deep explanation

IEnumerable executes queries in application memory, while IQueryable translates queries into provider-specific commands (e.g., SQL). This impacts performance and data transfer.

Real-world example

Filtering data in EF Core before fetching from database.

Common mistakes

  • Calling ToList() too early causing unnecessary data loading.

Follow-up questions

  • When does IQueryable execute?
  • Can IQueryable improve performance?

More LINQ interview questions

View all →