How can the Array elements be sorted in descending order? | C# interview Questions 32

To sort array elements in descending order in C#, you can use the Array.Sort() method followed by the Array.Reverse() method. Here’s the short answer:
Array.Sort(array);
Array.Reverse(array);
This first sorts the array in ascending order and then reverses it to get descending order.

Leave a Reply

Your email address will not be published. Required fields are marked *