LINQ OrderByDescending Query Operator

By Peter Bromberg

Sorts the elements of a sequence in descending order. This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

using (AdventureWorksEntities context = new AdventureWorksEntities())
   IQueryable<Decimal> sortedPrices =
        from p in context.Products
        orderby p.ListPrice descending
        select p.ListPrice;

   Console.WriteLine("The list price from highest to lowest:");
    foreach (Decimal price in sortedPrices)

LINQ OrderByDescending Query Operator  (1434 Views)