2 Dimensional Arrays
string[,] My2DimensionalArray;
My2DimensionalArray = new string[4, 10];
Or as a jagged array
string[][] My2DimensionalArray;
My2DimensionalArray = new string[2][];
My2DimensionalArray[0] = new string[20];
My2DimensionalArray[1] = new string[20];
Getting length of each part of an array
int[,] MyArray = new int[5, 10];
int Length = MyArray.GetLength(0); // Gets 5
int Length = MyArray.GetLength(1); // Gets 10
//N.B. GetLength(#) # is not the Index!
Example usage
int[,] MyArray = new int[5, 10];
int = Index;
int = Index1;
for (Index = 0; Index < MyArray.GetLength(0); Index++)
{
for (Index1 = 0; Index1 < MyArray.GetLength(1); Index1++)
int a = MyArray[Index,Index1];
}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.