A sorting operation orders the elements of a sequence based on one or more attributes.
OrderBy
Sorts values in ascending order.
Method Syntax
// OrderBy
var numbers = new int[] { 5, 4, 8, 2, 7, 1, 9, 3, 6 };
var ordered = numbers.OrderBy(n => n);
// ordered = { 1, 2, 3, 4, 5, 6, ...