I\'m trying to sort an ArrayList of String.
Given:
{A,C,AA,B,CC,BB}
Arraylist.Sort gives: >
It's easier to do this with Linq as so:
string [] list = { "A","C","AA","B","CC","BB"};
var sorted = list.OrderBy(x=>x.Length).ThenBy(x=>x);
Note that the OrderBy method returns a new list. If you want to modify the original, then you need to re-assign it as so:
list = list.OrderBy(x=>x.Length).ThenBy(x=>x).ToArray();