Guest MemberLanguage   English
.NET & C# · LINQ

How would you answer an interview scenario involving IEnumerable versus IQueryable in LINQ?

AdvancedUpdated 2026-08-09

For an interview scenario involving IEnumerable versus IQueryable, I would first clarify the business goal, scale, constraints, and the failure or quality attribute the interviewer wants to explore. IEnumerable runs LINQ-to-Objects operations, while IQueryable builds expression trees for a provider such as EF Core. In this scenario, a filter runs after one million rows have already been loaded. Explain the likely LINQ mistake. For production, keep database filtering and projection in IQueryable until materialization, then switch to in-memory processing only when needed. I would then explain the main alternatives and tradeoffs, identify likely failure modes, and describe how I would validate the solution through testing, observability, security controls, and recovery or rollback planning.

#linq#ienumerable#iqueryable