Use the Sort() method to sort the elements in a char array : Array object « Data Structure « C# / CSharp Tutorial






using System;

class MainClass
{

  public static void Main()
  {
    char[] charArray = {'w', 'e', 'l', 'c', 'o', 'm', 'e'};
    Array.Sort(charArray);  // sort the elements
    Console.WriteLine("Sorted charArray:");
    for (int i = 0; i < charArray.Length; i++)
    {
      Console.WriteLine("charArray[" + i + "] = " +
        charArray[i]);
    }
  }

}
Sorted charArray:
charArray[0] = c
charArray[1] = e
charArray[2] = e
charArray[3] = l
charArray[4] = m
charArray[5] = o
charArray[6] = w








11.3.Array object
11.3.1.string arrays
11.3.2.Use object to create a generic array.
11.3.3.Use the Sort() method to sort the elements in a char array
11.3.4.A two dimensional array of objects
11.3.5.Arrays of Objects