Which query parts should you use in sequence to complete the expression?

The user interface requires that a paged view be displayed of all the products sorted in alphabetical order.
The user interface supplies a current starting index and a page size in variables named startIndex and pageSize of type int.
You need to construct a LINQ expression that will return the appropriate Parts from the database from an existing
ContosoEntities context object named context. You begin by writing the following expression:
context.Parts

Which query parts should you use in sequence to complete the expression?
(To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)

The user interface requires that a paged view be displayed of all the products sorted in alphabetical order.
The user interface supplies a current starting index and a page size in variables named startIndex and pageSize of type int.
You need to construct a LINQ expression that will return the appropriate Parts from the database from an existing
ContosoEntities context object named context. You begin by writing the following expression:
context.Parts

Which query parts should you use in sequence to complete the expression?
(To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)

A.
.OrderBy(x => x.Name)

B.
.Skip(pageSize)

C.
.Skip(startIndex)

D.
.Take(pageSize);

E.
.Take(startIndex)



Leave a Reply 1

Your email address will not be published. Required fields are marked *


John Galt

John Galt

Verified using Visual Studio. The actual expression should look as following:

var selectedParts = _parts.Skip(startIndex).Take(pageSize).OrderBy(x = x.Name);