Use Foreach statement to loop through Rectangular Array : Multi Dimensional Array : Data Structure C# Examples


C# Examples » Data Structure » Multi Dimensional Array »

 

Use Foreach statement to loop through Rectangular Array









    
using  System;

class  MainClass
{
      static  void  Main()
      {
            int[,]  arr1  =  {  {  0,  1  },  {  2,  3  }  };

            foreach  (int  element  in  arr1)
            {
                  Console.WriteLine  ("Element:  {0}",  element);
            }
      }
}
    
   
  
   



Output

Element: 0
Element: 1
Element: 2
Element: 3


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» Multi Dimensional Array