Multidimensional Arrays

Just as a picture has two dimensions and the room you sit inside is three dimensional, a line only has one dimension and a dot zero dimensions. The five values represented by the array variable accountBalances of Listing 10.1 in Chapter 10, “Arrays Part I: Array Essentials,” can be viewed as being positioned on a line one after the other, and each value can be accessed by specifying exactly one index. For those reasons, accountBalances, along with the remaining arrays used in the previous chapter, are called one-dimensional arrays.

C# allows you to specify arrays of two dimensions, requiring two indexes to identify an array element, and arrays of three dimensions calling for three indexes. In fact, C# lets you specify ...

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.