什么是使用INT [] []和INT之间的差异[,]?差异、INT

由网友(泪、莫名心碎)分享简介:我来自一个Perl的背景下,我一直定义使用二维数组 INT [] [] 。我知道你可以用 INT [,] 而不是有啥区别?Coming from a perl background, I have always defined a 2D array using int[][]. I know you can use...

我来自一个Perl的背景下,我一直定义使用二维数组 INT [] [] 。我知道你可以用 INT [,] 而不是有啥区别?

Coming from a perl background, I have always defined a 2D array using int[][]. I know you can use int[,] instead so what are the differences?

推荐答案

这里所不同的是第一个样品,INT [] []创建交错数组,而第二个创建一个多维数组< (尺寸2)/一>。在参差不齐的阵列中的每个列可以是不同的尺寸。在一个真正的多维阵列,每个塔(在一个尺寸)为相同的大小。有关更完整的信息,请参阅 C#编程指南。

The difference here is that the first sample, int[][] creates a jagged array, while the second creates a multidimensional array (of dimension 2). In a jagged array each "column" can be of a different size. In a true multidimensional array, each "column" (in a dimension) is the same size. For more complete information see the Array section of the C# Programming Guide.

阅读全文

相关推荐

最新文章