獲取三維陣列的寬和高
假設我們的三維陣列是 −
int[,,] arr = new int[3,4,5];
要獲取高和寬,即行和列。
Array.GetLength(0) – for rows Array.GetLength(1) – for columns
示例
using System;
class Program {
static void Main() {
int[,,] arr = new int[3,4,5];
Console.WriteLine(arr.GetLength(0));
Console.WriteLine(arr.GetLength(1));
Console.WriteLine(arr.GetLength(2));
}
}輸出
3 4 5
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP