A two-dimensional rectangular string array : String Array : String C# Examples


C# Examples » String » String Array »

 

A two-dimensional rectangular string array









    
using  System;

class  MainClass
{

    public  static  void  Main()
    {
        const  int  rows  =  8;
        const  int  columns  =  8;
        string[,]  stringArray  =  new  string[rows,  columns];

        stringArray[0,  0]  =  "R";
        stringArray[1,  0]  =  "P";
        stringArray[2,  3]  =  "K";
        stringArray[3,  5]  =  "B";
        stringArray[4,  4]  =  "A";
        stringArray[5,  3]  =  "E";

        for  (int  row  =  0;  row  <  rows;  row++)
        {
            for  (int  column  =  0;  column  <  columns;  column++)
            {
                Console.WriteLine("stringArray["  +  row  +  ",  "  +  column  +  "]  =  "  +
                    stringArray[row,  column]);
            }
        }
    }
}
    
   
  
   



Output

stringArray[0, 0] = R
stringArray[0, 1] =
stringArray[0, 2] =
stringArray[0, 3] =
stringArray[0, 4] =
stringArray[0, 5] =
stringArray[0, 6] =
stringArray[0, 7] =
stringArray[1, 0] = P
stringArray[1, 1] =
stringArray[1, 2] =
stringArray[1, 3] =
stringArray[1, 4] =
stringArray[1, 5] =
stringArray[1, 6] =
stringArray[1, 7] =
stringArray[2, 0] =
stringArray[2, 1] =
stringArray[2, 2] =
stringArray[2, 3] = K
stringArray[2, 4] =
stringArray[2, 5] =
stringArray[2, 6] =
stringArray[2, 7] =
stringArray[3, 0] =
stringArray[3, 1] =
stringArray[3, 2] =
stringArray[3, 3] =
stringArray[3, 4] =
stringArray[3, 5] = B
stringArray[3, 6] =
stringArray[3, 7] =
stringArray[4, 0] =
stringArray[4, 1] =
stringArray[4, 2] =
stringArray[4, 3] =
stringArray[4, 4] = A
stringArray[4, 5] =
stringArray[4, 6] =
stringArray[4, 7] =
stringArray[5, 0] =
stringArray[5, 1] =
stringArray[5, 2] =
stringArray[5, 3] = E
stringArray[5, 4] =
stringArray[5, 5] =
stringArray[5, 6] =
stringArray[5, 7] =
stringArray[6, 0] =
stringArray[6, 1] =
stringArray[6, 2] =
stringArray[6, 3] =
stringArray[6, 4] =
stringArray[6, 5] =
stringArray[6, 6] =
stringArray[6, 7] =
stringArray[7, 0] =
stringArray[7, 1] =
stringArray[7, 2] =
stringArray[7, 3] =
stringArray[7, 4] =
stringArray[7, 5] =
stringArray[7, 6] =
stringArray[7, 7] =


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo String
» String Array