Chapter 10

Using arrays

After completing this chapter, you will be able to:

  • Declare array variables.

  • Create an array instance.

  • Populate an array with a set of data items and access those items.

  • Copy arrays.

  • Create and use multidimensional arrays.

You have already seen how to create and use variables of many different types. However, all the examples of variables you’ve seen so far have one thing in common: They hold information about a single item (an int, a float, a Circle, a Date, and so on). But what if you need to manipulate a set of items?

One solution is to create a variable for each item in the set, but this leads to some further questions:

  • How many variables do you need?

  • How should you name them?

  • If you need to perform the same operation ...

Get Microsoft Visual C# Step by Step, 10th Edition 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.