Arrays of More Than Two Dimensions

As mentioned earlier, C# lets you work with arrays of more than two dimensions. For example, if you want to collect elevator requests from 10 elevators instead of just one, and for 7 days/24 hours, you can match this requirement with a three-dimensional rectangular array declared as shown in Figure 11.12. The number of commas in the square brackets of the declaration must now be two instead of one; and three numbers, each specifying the length of a dimension, are needed when creating the three-dimensional array object.

Figure 11.12. Declaring and defining the three-dimensional rectangular requests array.

To traverse ...

Get C# Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.