Program-Defined Data Types

In addition to using the “simple” data types described earlier in this chapter, such as Integer, Decimal, and Boolean, a program can define new data types. The most common kinds of data types that a program can define are arrays, enumerations, structures, and classes.

Arrays

An array is a series of values with the same data type stored in a single chunk of memory. When a variable is an array, its name refers to the array as a whole, and an integer called index in the array lets the program select a particular value inside it.

As an analogy, you can think of an array as similar to the mailboxes in an apartment building. The building has a street address (the array’s name) that all the mailboxes share. Each mailbox has a ...

Get Start Here!™ Fundamentals of Microsoft® .NET Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.