I have a class called Order
which has properties such as OrderId
, OrderDate
, Quantity
, and Total
. I have a l
If you need to sort the list in-place then you can use the Sort method, passing a Comparison
objListOrder.Sort((x, y) => x.OrderDate.CompareTo(y.OrderDate));
If you prefer to create a new, sorted sequence rather than sort in-place then you can use LINQ's OrderBy method, as mentioned in the other answers.