Arrays with a Rank greater than 1 - CSharp Language Basics

CSharp examples for Language Basics:Array

Description

Arrays with a Rank greater than 1

Demo Code

using System;//from w w w.  j  a  va  2  s  .c  o m
public class ArrayTest {
   public static void Main( ) {
      int[,] grid = new int[3,3] { {1,2,3}, {4,5,6}, {7,8,9} };

      for( int i = 0; i < 3; i++ ) {
         for( int j = 0; j < 3; j++ ) {
            Console.Write("{0,3}", grid[i,j] );
         }
         Console.WriteLine("");
      }
   }
}

Result


Related Tutorials