Use LINQ OrderByDescending
method. It returns IOrderedIEnumerable<int>
, which you can convert back to Array if you need so. Generally, List<>
s are more functional then Array
s.
array = array.OrderByDescending(c => c).ToArray();
More Related Contents:
- Preserving order with LINQ
- Sort a list from another list IDs
- Alphanumeric sorting using LINQ
- How do I sort strings alphabetically while accounting for value when a string is numeric?
- LINQ order by null column where order is ascending and nulls should be last
- List sort based on another list
- The data source does not support server-side data paging
- LINQ Custom Sort
- List complex sorting
- Sort one list by another
- Use LINQ to move item to top of list
- How to have nested query with LINQ
- How do you sort a dictionary by value?
- Check whether an array is a subset of another
- LINQ to SQL – Left Outer Join with multiple join conditions
- Proper Linq where clauses
- What is the use of Enumerable.Zip extension method in Linq?
- Select distinct using linq [duplicate]
- How can I return an anonymous type from a method?
- How can I sort a string of text followed by a number using LINQ
- Generic All Controls Method
- Linq join iquery, how to use defaultifempty
- Why does the Linq Cast helper not work with the implicit cast operator?
- Count property vs Count() method?
- Pair-wise iteration in C#, or sliding window enumerator
- List.Except is not working
- The LINQ expression node type ‘ArrayIndex’ is not supported in LINQ to Entities
- Convert an array to dictionary with value as index of the item and key as the item itself
- Using LINQ to find item in a List but get “Value cannot be null. Parameter name: source”
- Get different and common items in two arrays with LINQ [closed]