How to make a sortedlist sort reversely? Do I have to customize a IComparer?
Yes you have to rewrite the comparer
example for string as key: (just exchanged x.CompareTo(y)
with y.CompareTo(x)
)
private class InvertedComparer : IComparer<String>
{
public int Compare(string x, string y)
{
return y.CompareTo(x);
}
}
and the call:
SortedList<string, Object> list = new SortedList<string, Object>(new InvertedComparer());