获取多维数组的维数和行数

获取多维数组的维数和行数

1 int[,,] a =new int[10,11,12]; 
2 Console.WriteLine(a.Length);           // 1320 
3 Console.WriteLine(a.GetLength(0));     // 10 
4 Console.WriteLine(a.GetLength(1));     // 11 
5 Console.WriteLine(a.GetLength(2));     // 12

多维数组的声明:

1 string[,] book_arr = new string[,] { { "English",  "101" }, 
2                                                  { "History",  "102" }, 
3                                                  { "Computer", "103" },
4                                                  { "Algorithm","104" } };
原文地址:https://www.cnblogs.com/alexzp/p/2737599.html