Sorting a List of objects in C#

后端 未结 11 1890
终归单人心
终归单人心 2020-12-07 18:01
public class CarSpecs
{
  public String CarName { get; set; }

  public String CarMaker { get; set; }

  public DateTime CreationDate { get; set; }
}
11条回答
  •  粉色の甜心
    2020-12-07 18:33

    The best approach is to implement either IComparable or IComparable, and then call List.Sort(). This will do all the hard work of sorting for you.

提交回复
热议问题