I have a List of objects: List<FakeObject> list = ...
Each object has a DateTime property, let's call it "Date"
I want to sort this list by this date property in descending order. However, when I try
list.Sort(new Comparison<FakeObject>((x, y) => DateTime.Compare(x.Date, y.Date)))
it complains because the Date property can be nullable.
How do I sort this list, where it treats nullable dates as MAX DATE, so it appears in the top? The quick easy alternative for me is to NOT make the Date field nullable, but let's suppose that's not an option right now.
In short: How do I sort a list of objects by DateTime, if the DateTime can be null?