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

C#ArraysDeclaration

C# Problem Overview


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?

C# Solutions


Solution 1 - C#

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

Multidimensional Arrays (C# Programming Guide)

Solution 2 - C#

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

Solution 3 - C#

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

Solution 4 - C#

It means it is a multidimensional array.

See MSDN.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionrickyView Question on Stackoverflow
Solution 1 - C#Justin NiessnerView Answer on Stackoverflow
Solution 2 - C#BStatehamView Answer on Stackoverflow
Solution 3 - C#IgorView Answer on Stackoverflow
Solution 4 - C#RyanView Answer on Stackoverflow