c# sort array string by length

C#
public static string[] SortLength(string[] arr)
        {
            string[] sorted = arr
                .OrderBy(x => x.Length) //.OrderByDescending
                .ToArray();

            return sorted;
        }
Source

Also in C#: