c# int[,] get element width
int GetWidth(object[,] matrix)
{
int i = 0;
try
{
int val = 0;
while (true)
{
val = matrix[matrix.GetLength(0) - 1, i];
i++;
}
return i;
}
catch
{
return i;
}
}