After reading this question, I need to clear up some things.
IQueryable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
IEnumerable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
Questions:
1) Is it ok to say that: in the first query the SQLServer is running the whole operation including where clause and returning ONLY the relevant rows - while the second one does SELECT *
... and returns all rows into C# and THEN filters ?
2) What about if I have a collection merely - in memory. ( var lstMyPerson = new List<MyPerson>()
)
IQueryable<MyPerson> lst = from c in lstMyPerson
where c.City == "<City>"
select c;
vs
IEnumerable<MyPerson> custs = from c in lstMyPerson
where c.City == "<City>"
select c;
what will be the difference in execution now?