I have a list of dates that I want to sort in an ascending order. However, the default comparer means that I have:
null null 18/01/2011 23/01/2011
You could try this:
messages.Sort((x, y) => (x.CreatedOn ?? DateTime.MaxValue).CompareTo(y.CreatedOn ?? DateTime.MaxValue));