How to Sort a List by a property in the object

前端 未结 20 1983
醉梦人生
醉梦人生 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:33

    Make use of LiNQ OrderBy

    List objListOrder=new List ();
        objListOrder=GetOrderList().OrderBy(o=>o.orderid).ToList();
    

提交回复
热议问题