Arrays

The CLR supports two kinds of composite types: one kind whose members are accessed by a locally unique name, and another whose members are unnamed but instead are accessed by position. The classes and structs described so far are examples of the former. Arrays are an example of the latter.

Arrays are instances of a reference type. That reference type is synthesized by the CLR based on the element type and rank of the array. All array types extend the built-in type System.Array, which is shown in Listing 5.11. This implies that all of the methods of System.Array are implicitly available to any type of array. That also means that one can write a method that accepts any type of array by declaring a parameter of type System.Array. In essence, ...

Get Essential .NET, Volume 1: The Common Language Runtime now with O’Reilly online learning.

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