O'Reilly logo

Visual C#® 2012: How to Program, Fifth Edition by Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercises

9.3 (Querying an Array of Invoice Objects) Use the class Invoice provided in the ex09_03 folder with this chapter’s examples to create an array of Invoice objects. Use the sample data shown in Fig. 9.8. 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:

a) Use LINQ to sort the Invoice objects by PartDescription.

b) Use LINQ to sort the Invoice objects by Price.

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required