O'Reilly logo

A Programmer's Guide to C# 5.0, 4th Edition by Nick Wienholt, Eric Gunnerson

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

CHAPTER 15

image

Arrays

Arrays in C# are reference objects; they are allocated out of heap space rather than on the stack. The elements of an array are stored as dictated by the element type; if the element type is a reference type (such as string), the array will store references to strings. If the element type is a value type (such as a numeric type or a struct type), the elements are stored directly within the array.

Arrays are declared using the following syntax:

<type > [] identifier;

The initial value of an array is null. An array object is created using new.

int[] store = new int[50];string[] names = new string[50];

When an array is created, ...

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