TreeView change the order even if comparer returns 0. There are some implementation flaw in Treeview.Sort(). Actually what I want to find out is, how the return value (-1, 0 and 1) of IComparer.Compare() impacts the behavior of method sort().I did some experiments in my simple application, and found out:If IComparer.Compare() returns -1, whenever I click the sort button, the nodes order changes - ascending and descending alternatively.If IComparer.Compare() returns 1, whenever I click the sort button, the nodes order does not change- it keeps the original order.They make sense. How about IComparer.Compare() returns 0?I thought it should be same as returning 1. but unfortunately it behaves like returning -1. Return 0 means TreeNode1 has the same sort value as TreeNode2, the original order should not be changed.Below is the original post, but nobody can give me a good answer:http://social.msdn.microsoft.com/forums/en-us/winforms/thread/4c6ac5df-6041-434b-aaf7-f5a2fbfc3e48
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results