What does it mean when there is a comma inside an array declaration? e.g. float[,]

ⅰ亾dé卋堺 提交于 2019-12-18 13:53:52

问题


I have some code I'm trying to understand while learning C#. I do not understand what I even need to search Google for to get here, but the code is as follows:

float[,] heightAll = terData.GetHeights(0, 0, allWidth, allHeight);

Why does the array declaration have a comma in between the brackets?


回答1:


That would be a two-dimensional array. You can also specify more dimensions:

Multidimensional Arrays (C# Programming Guide)




回答2:


Each comma adds an additional dimension to the array [,] = 2 dimensional [,,] = 3 dimensional ...




回答3:


That the array is multi-dimensional - two-dimensional in your case.




回答4:


It means it is a multidimensional array.

See MSDN.



来源:https://stackoverflow.com/questions/13807493/what-does-it-mean-when-there-is-a-comma-inside-an-array-declaration-e-g-float

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!