2017-02-27 4 views
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().NameSystem.Int32[][][,][]과 같지 않습니까?

답변

1

아무렇지도 않게 답변을 찾았습니다.

ECMA-334 섹션 19.1, 어레이 유형. C#이 반대입니다.