Multiply the results of the Comparison by -1? so to borrow
Nullable's example:
For ASC:
MyArticles.Sort(delegate(Article a, Article b)
{
return
a.CreatedDate.Value.CompareTo(b.CreatedDate.Value);
});
for DESC:
MyArticles.Sort(delegate(Article a, Article b)
{
return
a.CreatedDate.Value.CompareTo(b.CreatedDate.Value) * -1;
});
No comments:
Post a Comment