• 1.2k
  • 1k
  • 357.7k

linq in c# ? query

Feb 18 2014 1:26 AM

Class Invoice includes four properties—a PartNumber (type int), a PartDescription (type string), a Quantity of the item being purchased (type int) and a Price (type decimal). Perform the following queries on the array of Invoice objects and display the results:

c) Use LINQ to select the PartDescription and Quantity and sort the results by Quantity.
d) Use LINQ to select from each Invoice the PartDescription and the value of the Invoice
(i.e., Quantity * Price). Name the calculated column InvoiceTotal. Order the
results by Invoice value. [Hint: Use let to store the result of Quantity * Price in a new
range variable total.]
e) Using the results of the LINQ query in Part d, select the InvoiceTotals in the range
$200 to $500.


Answers (1)