How to sort with LINQ OrderBy in C#
The LINQ OrderBy() and OrderByDescending() methods sort a sequence without modifying the original collection. They return a new IOrderedEnumerable<T> that you can chain with ThenBy() for multi-key sorting.
Unlike List<T>.Sort(), which mutates the list in place, LINQ ordering always produces a new sequence.
OrderBy() uses a stable sort: elements with equal keys preserve their original order.
On this page
Basic Ascending Sort
Descending Sort
Sort a List of Strings
Sort Objects by Property
Multi-Key Sort with ThenBy
ThenByDescending
Sort Strings by Length
Method Syntax vs Query Syntax
OrderBy vs List.Sort: Key Differences
OrderBy() (LINQ) | List<T>.Sort() | |
|---|---|---|
| Source | Any IEnumerable<T> | List<T> only |
| Mutates original | No, returns new sequence | Yes, sorts in place |
| Return type | IOrderedEnumerable<T> | void |
| Stable sort | Yes | Yes (.NET 5+) |
| Multi-key | ThenBy() / ThenByDescending() | Custom IComparer<T> |
| Use case | Functional pipeline | In-place mutation |
Take It Further

The most comprehensive book covering C# 12 and .NET 8 from scratch to production.
C# 12 and .NET 8: Modern Cross-Platform Development · Mark J. Price
Get it on Amazon →As an Amazon Associate I earn from qualifying purchases.
Related Articles
Sort a C# list with Sort() for in-place modification, or LINQ OrderBy() for a new sorted sequence that leaves the original list unchanged.
Filter a collection in C# with LINQ Where() by passing a predicate function. Uses deferred execution and returns only elements satisfying the condition.
Use LINQ Select() in C# to project each element into a new form. Transforms a collection with a lambda and returns a new IEnumerable with the results.