score:11

Accepted answer

Update: Thanks @JeppeStigNielsen for correct comment, I add StringComparer.Ordinal to support in all cultures:

var result = List.OrderBy(p=>p.Length).ThenBy(p=>p,StringComparer.Ordinal);

score:3

First order by the length of column name ("C" comes before "AB"), then use normal alphabetical (string) sorting on strings with same length ("AC" before "AD").

var columns = new[] { "A", "C", "AB", "AD", "N", "Z", "AC" };
var sorted = columns.OrderBy(c => c.Length)
                    .ThenBy(c => c);

Related Articles