I have a C # ArrayList with objects that include the following fields. I have about 10 objects in an ArrayList . My problem is that I need to sort an ArrayList based on the StartDate available on the system, which is a DateTime variable.
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; }
Can someone please enlighten me? I tried .Sort() , but it just doesnโt do anything (dump it to try sorting by ArrayList , which has objects that I know).
Thanks in advance.
Update:
List<Appointment> appointments = new List<Appointment>();
I created a List as above. Can I sort it now?
source share