In c# (3.0 or 3.5, so we can use lambdas), is there an elegant way of sorting a list of dates in descending order? I know I can do a straight sort and then reverse the whole
Though it's untested...
docs.Sort((x, y) => y.StoredDate.CompareTo(x.StoredDate));
should be the opposite of what you originally had.
docs.Sort((x, y) => -x.StoredDate.CompareTo(y.StoredDate));
Note the minus sign.
docs.Sort((x, y) => y.StoredDate.CompareTo(x.StoredDate));
Should do what you're looking for.
What's wrong with:
docs.OrderByDescending(d => d.StoredDate);