Use System.Array.Sort() to sort an int array : Array Sort « Data Structure « C# / CSharp Tutorial






using System;

class MainClass
{
    public static void Main()
    {
        int[] arr = {5, 1, 10, 33, 100, 4};
        Array.Sort(arr);
        foreach (int v in arr)
           Console.WriteLine("Element: {0}", v);
    }
}
Element: 1
Element: 4
Element: 5
Element: 10
Element: 33
Element: 100








11.18.Array Sort
11.18.1.Sort an array
11.18.2.Sort an array and search for a value
11.18.3.Display the contents of the sorted array
11.18.4.Use System.Array.Sort() to sort an int array
11.18.5.Implementing IComparable and sort by Array.Sort
11.18.6.Use Array.Sort to sort object array
11.18.7.Use the Sort() method to sort the elements in an int array