C# 14 · Collections and LINQ

Sort by one or more keys

Sort by one key, then break ties with another.

var sorted = users.OrderBy(u => u.LastName).ThenByDescending(u => u.Age);

Official C# 14 documentation

More collections and linq commands

All collections and linq commands · C# 14 cheatsheet

Was this page helpful?