I know I can use linq syntax on collections that implement IQueryable or IEnumerable.
Does IQueryable use lazy calaulation and optimization, while IEnumerable not?
Does optimization include reordering of the queries?
Linq on an IEnumerable
is using Linq to Objects - Linq on an IQueryable
is using whatever the query provider has implemented for the standard query operators.
For ORMs like Linq to SQL and Entity Framework i.e. that means translating your Linq query into the corresponding SQL query on the database - filtering etc. on the database is much preferred to moving all that data into memory as it will have much better performance.
No, IQueryable is typically supported by database-oriented providers and supports translation to SQL.
Any optimizations would be due to the SQL engine.
Both IQueryable and IEnumerable have deferred execution.interface IQueryable<T> : IEnumerable<T> ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With