Chapter 12. Arrays

Arrays in C# is a more complex topic than in Java. Java has only one category of multi-dimensional array. C# groups multi-dimensional arrays into two distinct categories: 'normal' rectangular arrays, and jagged arrays (see Figure 12.1). Things can be a bit confusing because you can view a Java multi-dimensional array as in either category, though I personally think that it fits a little better into 'rectangular arrays'.

Figure 12.1. The different types of arrays in C#.

We will start with the simplest, one dimensional (1D) arrays. Then rectangular multi-dimensional arrays will be covered followed by the more complex jagged multi-dimensional ...

Get From Java to C#: A Developer's Guide 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.