1
가변 길이, 지그재그 형, 들쭉날쭉 한 배열을 선언하고 GetType()
메서드를 호출 할 때 형식 이름의 대괄호가 선언 한 형식과 일치하지 않습니다. 대괄호가 반대로 표시됩니다.C# 가변 길이 지그재그 형 배열 유형 이름이 올바르지 않음
왜?
관찰 :
: 여기INT32 [] [] [] []
거짓
트루
class Program
{
static void Main(string[] args)
{
//Declare and allocate a jagged, jagged, multidimensional, jagged array
int[][][,][] x = new int[10][][,][];
// GetType outputs "Int32[][,][][]", why not "System.Int32[][][,][]" ?
Console.WriteLine(x.GetType().Name
);
//text copied from above does not equal the type, this is this False, why?
Console.WriteLine(typeof(System.Int32[][,][][]).Equals(typeof(int[][][,][]))
);
//Reversing jagged, multidimensional square brackets of x.GetType().Name results in True
Console.WriteLine(typeof(System.Int32[][][,][]).Equals(typeof(int[][][,][]))
);
}
}
이 실시 예의 출력
왜 GetType().Name
은 System.Int32[][][,][]
과 같지 않습니까?