Display the contents of the sorted array : Array Sort : Data Structure C# Examples


C# Examples » Data Structure » Array Sort »

 

Display the contents of the sorted array









    
using  System;
using  System.Collections;

class  MainClass
{
        public  static  void  Main(string[]  args)
        {
                        //  Create  a  new  array  and  populate  it.
                        int[]  array  =  {  4,  2,  9,  3  };

                        //  Sort  the  array.
                        Array.Sort(array);

                        foreach  (int  i  in  array)  {  
                                Console.WriteLine(i);  
                        }
        
        }
}
    
   
  
   



Output

2
3
4
9


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» Array Sort