How to Sort a List by a property in the object

前端 未结 20 1982
醉梦人生
醉梦人生 2020-11-21 08:25

I have a class called Order which has properties such as OrderId, OrderDate, Quantity, and Total. I have a l

20条回答
  •  孤街浪徒
    2020-11-21 08:42

    The easiest way I can think of is to use Linq:

    List SortedList = objListOrder.OrderBy(o=>o.OrderDate).ToList();
    

提交回复
热议问题