Descending Order

CodeKeep C# Feed Maggio 14th, 2008

Description: Use in SortedList Class or in sort Method.

Link: http://www.codekeep.net/snippets/a034d2b0-5989-42cf-855b-8775b2fcc12d.aspx

public class DescendingComparer : IComparer
{
CaseInsensitiveComparer _comparer = new CaseInsensitiveComparer();
public int Compare(object x, object y)
{
// Reversing the compared objects to
// get descending comparisons
return _comparer.Compare(y, x);
}
}

  • .NET
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Comments are closed.

Trackback URI |