Using Arrays

We're already familiar with arrays; they're those indexed collections of objects that must be the same type. Arrays are based on the System.Array class, but you don't use this class directly to create arrays (System.Array is an abstract class); as we've seen, you use C# language syntax like this to create an array:

int[] intArray = new int[4] {1, 2, 3, 4};

We have already discussed the fundamentals of handling arrays—they're zero-based collections that are reference types. We've seen the default value of array elements in Chapter 3, “C# Object-Oriented Programming,” (Table 3.2). However, we haven't learned about the power that the Array class, which arrays are based on, gives us. You can find the significant public properties of ...

Get Microsoft® Visual C#® .NET 2003 Kick Start 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.