I have a array of int which I have to sort by descending.
Since I did not find any method to sort the array in descending order.Currently I am sorting the array in
For in-place sorting in descending order:
int[] numbers = { 1, 2, 3 }; Array.Sort(numbers, (a, b) => b - a);
For out-of-place sorting (no changes to input array):
int[] numbers = { 1, 2, 3 }; var sortedNumbers = numbers.OrderByDescending(x => x).ToArray();