배열의 길이를 찾으려면 Array.Length() 메서드를 사용하세요.
예
예를 들어 보겠습니다 -
using System;
class Program {
static void Main(){
int[] arr = new int[10];
// finding length
int arrLength = arr.Length;
Console.WriteLine("Length of the array: "+arrLength);
}
} 출력
Length of the array: 10
위에 배열이 있습니다 -
int[] arr = new int[10];
이제 길이를 찾기 위해 Length() 메서드를 사용했습니다 -
int arrLength = arr.Length;