什么是使用INT [] []和INT之间的差异[,]? [英] What are the differences between using int[][] and int[,]?

查看:196
本文介绍了什么是使用INT [] []和INT之间的差异[,]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自一个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)/一>。在参差不齐的阵列中的每个列可以是不同的尺寸。在一个真正的多维阵列,每个塔(在一个尺寸)为相同的大小。有关更完整的信息,请参阅阵列部分 =HTTP:// MSDN .microsoft.com / EN-US /库/ 67ef8sbd.aspx> 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.

这篇关于什么是使用INT [] []和INT之间的差异[,]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆