C#의 GetLongLength 메서드는 Array의 지정된 차원에 있는 요소 수를 나타내는 64비트 정수를 가져옵니다.
먼저 배열을 설정합니다.
long[,] arr2= new long[15, 35];
배열의 지정된 차원에 대해 GetLongMethod() 메서드에서 −
와 같이 인덱스를 설정합니다.long len2 = arr2.GetLongLength(0);
전체 예를 살펴보겠습니다.
예시
using System;
class Program {
static void Main() {
int[,] arr = new int[20, 30];
int len = arr.GetLength(0);
Console.WriteLine(len);
long[,] arr2= new long[15, 35];
long len2 = arr2.GetLongLength(0);
Console.WriteLine(len2);
}
} 출력
20 15