LINQ Flashcards

1
Q

What are the two types of LINQ query in C#?

A
  1. Local queries

2. Interpreted queries (remote)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the two types of syntax for local queries?

A
  1. Fluent syntax

2. Query syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Types implementing which interface can be consumed by local queries?

A

IEnumerable T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which interface do Interpreted Queries use?

A

IQueryable T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s an example of an API that exposes IQueryable T ?

A

Entity Framework (EF Core)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What method can you call on an ordinary enumerator collection to expose an IQueryable T wrapper?

A

AsQueryable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do local query statements resolve to?

A

Query operators which, in turn, resolve to chains of decorators.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What do interpreted queries resolve to?

A

Query operators in the Queryable class, which emit expression trees.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What interface does IQueryable T extend and what additional methods does it provide?

A

IEnumerable T. It provides additional methods for constructing expression trees.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What execution model do Interpreted queries follow?

A

A deferred execution model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When do both Local and Interpreted queries execute?

A

Upon enumeration of the type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which method casts an IQueryable T sequence to an IEnumerable T?

A

AsEnumerable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the basic units of data in LINQ?

A

Sequences and elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly