Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C # The tblMagInfo table contains three fields. The Code and Cost fields are num

ID: 3672731 • Letter: C

Question

C # The tblMagInfo table contains three fields. The Code and Cost fields are numeric. The Magazine field contains text. The dataset's name is MagsDataSet.

Write a LINQ statement that arranges the records in descending order by the Cost field.

Write a LINQ statement that selects records having a code of 9.

Write a LINQ statement that selects records having a cost of $3 or more.

Write a LINQ statement that selects the Daily Food Guide magazine.

Write a LINQ statement that selects magazines whose name begins with the letter G (in either uppercase or lowercase).

Write a LINQ statement that calculates the average cost of a magazine.

Justify your answers using examples and reasoning.

Explanation / Answer

Let us assume that the result is stored in a list named lstMagInfo.

Write a LINQ statement that arranges the records in descending order by the Cost field.

Write a LINQ statement that selects records having a code of 9.

var list = lstMagInfo.(x=>x.code==9);

Write a LINQ statement that selects records having a cost of $3 or more.

var list = lstMagInfo.(x=>x.cost>=3);

Write a LINQ statement that calculates the average cost of a magazine.