C#の配列で行数を取得する方法を紹介します。
広告
Lengthだと全ての要素の数が返ってきます。GetLength(0)で行数が返ってきます。
string[,] stringArray = {{"one", "1"}, {"two", "2"}, {"three", "3"}}; Debug.Log(stringArray.Length); // 6 Debug.Log(stringArray.GetLength(0)); // 3
C#の配列で行数を取得する方法を紹介します。
広告
Lengthだと全ての要素の数が返ってきます。GetLength(0)で行数が返ってきます。
string[,] stringArray = {{"one", "1"}, {"two", "2"}, {"three", "3"}}; Debug.Log(stringArray.Length); // 6 Debug.Log(stringArray.GetLength(0)); // 3
広告