Mid From PDF LINQ LINQ

Why is LINQ deferred?

Short answer: Why is LINQ deferred? var query = employees.Where(e => e.Salary > 70000); employees.Add(new Employee { Id = 6, Name = "Frank", Department = "IT", Salary = 90000 }); foreach (var emp in query) Console.WriteLine(emp.Name); ✅ Output includes “Frank” — because query is executed at enumeration time. Why is LINQ deferred? var query =… employees.Where(e =>…… e.Salary > 70000); employees.Add(new Employee { Id = 6, Name =…

Explain a bit more

"Frank", Department = "IT", Salary = 90000 }); foreach (var emp in query) Console.WriteLine(emp.Name); ✅ Output includes “Frank” — because query is executed at enumeration time.

Real-world example (ShopNest)

ShopNest builds a LINQ query for search filters, then calls ToListAsync() once in the repository—so the SQL runs one time, not inside a loop.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
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