IEnumerable < T > is great for working with in-memory collections, but IQueryable< T > allows for a remote data source, like a database or web service.
IEnumerable doesn’t have the concept of moving between items, it is a forward only collection. It’s very minimalistic; something that most any data source can provide. Using only this minimal functionality, LINQ can provide all of these great operators.
IQueryable<T> is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries).
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;
No comments:
Post a Comment