我有一个ArrayList包含以下字段的对象的 C#。我在ArrayList. 我的问题是我需要ArrayList根据StartDate系统中可用的 DateTime 变量进行排序。
public int id { get; set; }
public string title {get; set;}
public bool allDay { get; set; }
public string start { get; set; }
public string end { get; set; }
public string color { get; set; }
public DateTime startDate { get; set; }
public DateTime endDate { get; set; }
public string Location { get; set; }
public string StartDatestr { get; set; }
public string EndDatestr { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
public bool Alert { get; set; }
public bool Repeat { get; set; }
public Int32 RepeatDays { get; set; }
public Int32 CalendarID { get; set; }
public int CustomerNo { get; set; }
public string CustomerName { get; set; }
public bool IsProspect { get; set; }
public string Description { get; set; }
有人可以启发我吗?我试过.Sort()了,但它什么也没做(它的转储尝试排序ArrayList有我知道的对象)。
提前致谢。
更新:
List<Appointment> appointments = new List<Appointment>();
我创建了List如上。现在我可以排序了吗?