LINQ Flashcards
What are the two types of LINQ query in C#?
- Local queries
2. Interpreted queries (remote)
What are the two types of syntax for local queries?
- Fluent syntax
2. Query syntax
Types implementing which interface can be consumed by local queries?
IEnumerable T
Which interface do Interpreted Queries use?
IQueryable T
What’s an example of an API that exposes IQueryable T ?
Entity Framework (EF Core)
What method can you call on an ordinary enumerator collection to expose an IQueryable T wrapper?
AsQueryable
What do local query statements resolve to?
Query operators which, in turn, resolve to chains of decorators.
What do interpreted queries resolve to?
Query operators in the Queryable class, which emit expression trees.
What interface does IQueryable T extend and what additional methods does it provide?
IEnumerable T. It provides additional methods for constructing expression trees.
What execution model do Interpreted queries follow?
A deferred execution model.
When do both Local and Interpreted queries execute?
Upon enumeration of the type.
Which method casts an IQueryable T sequence to an IEnumerable T?
AsEnumerable
What are the basic units of data in LINQ?
Sequences and elements.