declare a 2d array in c# code example
Example 1: how to declare 2d array in c#
// Two-dimensional array.
int[,] array2D = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
Example 2: C# public 2d array
// in namespace, above main form declaration
public class Globals
{
public static string[,] tableArray;
}
//... in main or other method
Globals.tableArray = new string[rowLength,colLength];