O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

System.Array Is a Reference Type

The System.Array class is a reference type like System.String. Consequently an array variable containing a reference is separate from the array object it is referencing. A reference type variable can be assigned different references, just as a variable of a numeric type can be assigned different numbers. So an array variable can reference different array objects at different segments in a program by assigning different references to it. Recall the state of affairs after the following statement

decimal [] accountBalances = new  decimal[5];

as illustrated earlier in Figure 10.2. The accountBalances variable is referencing an array object of base type decimal and length 5. Suppose that later in the program you want ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required