I am trying to sort the nodes of the tree structure with respect to their text property, of course. The problem is that my comparison class does not care about numbers. Here is the code:
public class TreeNodeSorter : IComparer
{
public int Compare(object x, object y)
{
var tx = x as TreeNode;
var ty = y as TreeNode;
return string.Compare(tx.Text, ty.Text);
}
}
And here is the result:

The first child node (Debug ...) is fine, but my problem is why on earth "HBM \ D10" is sorted to "HBM \ D7", etc ....
source
share