VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/linq-sorting-operator-orderbydescending/

⇱ LINQ | Sorting Operator | OrderByDescending - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

LINQ | Sorting Operator | OrderByDescending

Last Updated : 11 Jul, 2025
In LINQ, sorting operators are used to rearrange the given sequence in ascending or descending order based on one or more attributes. There are 5 different types of sorting operators are available in LINQ:
  1. OrderBy
  2. OrderByDescending
  3. ThenBy
  4. ThenByDescending
  5. Reverse

OrderByDescending Operator

OrderByDescending operator is used to rearranging the elements of the given sequence in descending order. It does not support query syntax in C# and VB.Net. It only supports method syntax. If you want to rearrange or sort the elements of the given sequence or collection in descending order in query syntax, then use descending keyword as shown in below example. And in method syntax, use OrderByDescending () method to sort the elements of the given sequence or collection. This method is present in both the Queryable and Enumerable class. And the method syntax is supported by both C# and VB.Net languages. As shown in the below examples. The OrderByDescending method sorts the elements of the collection according to a single property, you are not allowed to sort the collection using multiple properties. Example 1: Output:
Employee ID: 214
Employee ID: 213
Employee ID: 212
Employee ID: 211
Employee ID: 210
Employee ID: 209
Example 2:
Output:
Employee Name: Supriya
Employee Name: Soniya
Employee Name: Rohit
Employee Name: Anju
Employee Name: Anjita
Employee Name: Anil
Comment
Article Tags:
Article Tags:

Explore