How to

sort array ascending

Published: 20. October 2011 | Updated: 26. October 2011
License: Microsoft Public License (MS-PL)
Categories: Framework » Arrays
Tags: Array C#
Was this snippet helpful for you? YESYES / NONO
int[] array = new int[] { 5, 9, 3, 7, 1 };
Array.Sort(array);

foreach (int i in array)
{
    Console.WriteLine(i);
}
Console Output:
1
3
5
7
9
Send us feedback about this snippet »



Related Snippets: