How can I declare a two dimensional string array?

delete picture delete · Sep 28, 2010 · Viewed 237.8k times · Source
string[][] Tablero = new string[3][3];

I need to have a 3x3 array arrangement to save information to. How do I declare this in C#?

Answer

explorer picture explorer · Sep 28, 2010
string[,] Tablero = new string[3,3];

You can also instantiate it in the same line with array initializer syntax as follows:

string[,] Tablero = new string[3, 3] {{"a","b","c"},
                                      {"d","e","f"}, 
                                      {"g","h","i"} };