Possible Duplicate:
Multiple “order by” in LINQ
I have a list of orders and I need to order it by the date of the order and then a secondary sort by the price of the order. I’m not sure how exactly to do this since I tried orders.OrderBy(o => o.Date).OrderBy(o => o.Price), but it doesn’t work. Any help is much appreciated. Thank you
You want to use the ThenBy function:
orders.OrderBy(o => o.Date).ThenBy(o => o.Price)