Introduction
This code snippet is sorting values in array using C#.
Code
- using System;
- using System.Collections;
-
- public class Program
- {
- public static void Main()
- {
- int[] array = { 2, 11, 15, 1, 7, 99, 6, 85, 4 } ;
-
- Array.Sort(array);
-
- foreach (var result in array)
- {
- Console.Write(result + " ");
- }
- }
- }
Output
1 2 4 6 7 11 15 85 99
Demo : https://dotnetfiddle.net/8PusDB