问题
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