public static void Main()
string[] arr = { "A", "C", "DE","FDSA" , null, "", "Z"};
Array.Sort(arr, myComparison);
foreach (var item in arr) {
static int myComparison(string x, string y) {
bool xIsNull = string.IsNullOrWhiteSpace(x);
bool yIsNull = string.IsNullOrWhiteSpace(y);
if (xIsNull && yIsNull) { return 0; }
if (xIsNull) { return -1; }
if (yIsNull) { return 1; }
if (x.Length != y.Length) {
return x.Length.CompareTo(y.Length);