CHAPTER 15
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, ...
Get A Programmer's Guide to C# 5.0, 4th 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.