Sort List Descending

后端 未结 4 1784
无人共我
无人共我 2020-12-13 17:19

In c# (3.0 or 3.5, so we can use lambdas), is there an elegant way of sorting a list of dates in descending order? I know I can do a straight sort and then reverse the whole

4条回答
  •  悲哀的现实
    2020-12-13 17:59

    docs.Sort((x, y) => y.StoredDate.CompareTo(x.StoredDate));
    

    Should do what you're looking for.

提交回复
热议问题