I'm trying to figure out the best way to custom sort a List. Lets say that T is a Object with a date(DateTime?) property and a status(string) property.
I have 3 cases...
"Urgent": I want these at the top of the list, no particular order
date = null
status = "Urgent"
"Normal": I want these ordered by date after the Urgent cases
date = any valid date/time
status = "On Time"
"Later": I want these at the bottom of the list, no particular order
date = null
status = "Later"
Any thoughts? Should I use an IQuerable object instead of List? I can always .ToList() the object later to send to my view.
Shouldn't be too difficult, just make T
implement IComparable
using your comparison rules and you should be set.