close
動態宣告陣列及取得陣列長度的方法:
在刮號中使用逗號隔開[,]
取得長度: GetLength(維度idx)
Example:---
void ArrayTest()
{
int x = 3;
int y = 2;
int[,] array = new int[x,y];
array[0,0] =1;
array[2,1] =5;
Debug.Log("row:"+array.GetLength(0)+" Column:" +array.GetLength(1));
}
------
Output:
row:3 Column:2
文章標籤
全站熱搜
留言列表