47 ms·
That's not the same, though; that's you purposefully combining your query (which you can do in LINQ). LINQ doesn't just combine Wheres. It tries to optimize yo
by mynameisvlad 12y ago
That's not the same, though; that's you purposefully combining your query (which you can do in LINQ).
LINQ doesn't just combine Wheres. It tries to optimize your query as much as possible and executes lazily, so you aren't actually doing any work until you try to use the resultset (in a ToList, for example).
- Todd 12y agoYes. IQueryable actually implements an expression tree, which means that it may never be executed, at least directly. LINQ to Entities (Entity Framework) actually evaluates the expression tree to build SQL statements, then runs those and returns the results (after coercion back to the mapped POCO object).
- emodendroket 12y agoRight. Actually Linq to SQL did the same thing, but a big philosophical difference is Entity will reject stuff that it can't resolve from the database instead of just letting you do whatever (which may involve multiple queries).
- delluminatus 12y agoI don't know about Underscore, but lo-dash [0] supports lazy execution of a chained query without generating intermediate arrays (see docs [1]). It offers something pretty similar to LINQ queries on collections (except you don't get the benefit of strong typing). [0]: https://lodash.com/ https://lodash.com/ [1]: https://lodash.com/docs#_ https://lodash.com/docs#_