I\'m trying to sort an ArrayList of String.
ArrayList
String
Given:
{A,C,AA,B,CC,BB}
Arraylist.Sort gives: >
Arraylist.Sort
You could create an IComparable class taking in two Strings and sort them as follows:
IComparable
if (a.Length == b.Length) return String.Compare(a, b); return a.Length.CompareTo(b.Length);
You may also want to handle null cases.
null