I have a field in my database that holds a DateTime?. I would like to sort the results so that the NULLs show up at the top, then descending by DateTime, e.g.,
null
null
2012-04-01
2012-01-01
2011-09-04
The reason is that I am looking at expiration dates, though some entries do not expire.
You can return DateTime.MaxValue instead of
nullfrom the ordering expression, so rows withnulldates are sorted first: