C# Program to Sort Student Names in Descending Order using LINQ Last Updated : 29 Dec, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Given a list of student names, now our task is to sort the names given in the list in descending order using the LINQ, This task can be done using OrderByDescending() method of LINQ. This method is used to sort the elements in the collection in descending order. While using this method in the LINQ query you don't need to add an extra condition to sort the list in descending order. Example: Input : [ "sai", "narendra", "Mohan", "sundar", "vasu" ] Output : [ "vasu", "sundar", "sai", "narendra", "mohan" ] Input : [ "akhil", "amrutha", "yeswanth", "praveen" ] Output : [ "yeswanth", "praveen", "amrutha", "akhil" ]Approach Create and initialize a list of strudent names of type string. For example arr.Sorting the list(named arr) using OrderByDescending() method.var finalres = arr.OrderByDescending(n => n);Display the result using the foreach loop. C# // C# program to sort student names in // descending order using Linq. using System; using System.Linq; using System.Collections.Generic; class GFG{ static void Main(string[] args) { // Creating and initializing list List<string> students = new List<string>(){ "akhil", "amrutha", "yeswanth", "praveen" }; // Sorting the student names in descending order var result = students.OrderByDescending(n => n); // Display the sorted list Console.Write("Sorted list in Descending order:\n"); foreach (string student in result) { Console.Write(student + " "); } } } OutputSorted list in Descending order: yeswanth praveen amrutha akhil Comment More infoAdvertise with us Next Article C# Program to Sort a List of Integers Using the LINQ OrderBy() Method P pulamolusaimohan Follow Improve Article Tags : C# C# Programs CSharp LINQ Similar Reads C# Program to Sort a List of String Names Using the LINQ OrderBy() Method Given a list of string names, now our task is to sort the names given in the list using the OrderBy() method of LINQ. This method is used to sort the elements in the collection in ascending order. While using this method in the LINQ query you don't need to add an extra condition to sort the list in 2 min read C# Program to Sort a List of Integers Using the LINQ OrderBy() Method Given a list of integers, now our task is to sort the given list of integers. So we use the OrderBy() method of LINQ. This method is used to sort the elements in the collection in ascending order. This method is overloaded in two different ways: OrderBy<TSource, TKey>(IEnumerable<TSource 2 min read C# Program to Find Integer Numbers from the List of Objects and Sort them Using LINQ Given a list of objects, we need to find the integer double numbers from the list of objects and sort them using LINQ. So this task can be done using the OfType() method and then the sorting of numbers can be done by using OrderBy() method. Let discuss them one by one along with their syntax: 1. OfT 2 min read C# Program to Join Multiple Data Sources using LINQ LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It provides the ability to .NET languages to create queries to retrieve data from the data source. In this article, we will discuss how to join multiple data sources using LINQ. Here data source means list. So we are using 4 min read C# Program to Sort a List of Employees Based on Salary using LINQ Given a list of employees, now we sort the list of employees according to their salary using LINQ. So to this task, we use the OrderBy() method. This method is used to sort the elements of the specified sequence in ascending order. Example: Input: {id = 101, Name = Rohit, Salary = 50000, Department 3 min read C# Program to Sort a List of Employees Based on Salary in Descending Order and Whose Department is XYZ using LINQ Given a list of employees, now we sort the list according to the salary in descending order and whose department is XYZ. So we use the OrderByDescending() method of LINQ along with the Where() method. The OrderByDescending() is used to sort the specified list in descending order. To solve the given 2 min read Like