1
当声明锯齿状,多维,锯齿状,锯齿状数组并调用其方法时,该类型名称中的方括号与我声明的类型不匹配。看来方括号是相反的。c#锯齿状多维锯齿阵列类型名称显示不正确
为什么?
观察:
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[][][,][]))
);
}
}
下面是实施例的输出:
的Int32 [] [] [] []
假
真
为什么GetType().Name
不等于System.Int32[][][,][]
?