Say I have the following:
public void MakeMatrix(int matrixLength)
{
int[,] Matrix = new Matrix[matrixLength,matrixLength]
PopulateMatrix(Matrix);
PrintMatrix(Matrix);
}
In a function PrintMatrix(int[,] Matrix), how do I find the length of only one dimension of a multidimensional array?
public void PrintMatrix(int[,] Matrix)
{
int intLength =
for (int k = 0; k < intLength ; k++)
{
for (int l = 0; l < intLength; l++)
{
Console.Write("{0,2} ", Matrix[k, l]);
}
Console.WriteLine();
}
}
source
share