Chapter 10. Arrays

Almost all of the examples in previous chapters have dealt with one object at a time. In many applications, however, you want to work with a collection of objects all at the same time. The simplest collection in C# is the array, and it’s the only collection type for which C# provides built-in support. The other collection types, such as stack and queue, are not part of the language; they are part of the Framework Class Library, and we’ll cover those in detail in Chapter 14. The cool thing about arrays is that you can pass them around as though they were a single object, yet they contain several objects of the same type. Arrays really come into their own in combination with loops, which you learned about back in Chapter 5. In this chapter, you will learn to work with three types of arrays: one-dimensional arrays, multidimensional rectangular arrays, and jagged arrays.

Get Learning C# 3.0 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.