Ordering Operators

Ordering operators allow sorting query results according to the given condition. Within LINQ queries this is accomplished via the Order By clause. This clause allows ordering query results in both ascending and descending fashions, where ascending is the default way. The following example sorts the query result so that products are ordered from the one that has the lowest unit price to the one having the highest unit price:

image

To get a result ordered from the highest value to the lowest, you use the Descending keyword as follows:

This can shape the query result opposite of the first example. You can also provide more than one ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.