using System; class MainClass { public static void Main() { string[] stringArray = {"t", "i", "a", "test", "abc123", "abc345"}; Array.Sort(stringArray); Console.WriteLine("Sorted stringArray:"); for (int i = 0; i < stringArray.Length; i++) { Console.WriteLine("stringArray[" + i + "] = " + stringArray[i]); } } }
Sorted stringArray: stringArray[0] = a stringArray[1] = abc123 stringArray[2] = abc345 stringArray[3] = i stringArray[4] = t stringArray[5] = test