|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Arrays in the Common Type System
An array type is defined by specifying the element type of the array, the rank (number of dimensions) of the array, and the upper and lower bounds of each dimension of the array. All these are included in any signature of an array type, although they might be marked as dynamically (rather than statically) supplied. Exact array types are created automatically by the runtime as they are required, and no separate definition of the array type is needed. Arrays of a given type can only hold elements of that type. For more information on the type of a value, see the section "Values and Objects" in.
Values of an array type are objects. Array objects are defined as a series of locations where values of the array element type are stored. The number of repeated values is determined by the rank and bounds of the array.
Array types inherit from the type System.Array. This class represents all arrays regardless of the type of their elements or their rank. The operations defined on arrays are: allocating an array based on size and lower bound information; indexing an array to read and write a value; computing the address of an element of an array (a managed pointer); and querying for the rank, bounds, and total number of values stored in an array.
Arrays of one dimension with a zero lower bound for their elements (sometimes called vectors) have a type based on the type of the elements in the array, regardless of the upper bound. Arrays with more than one dimension, or with one dimension but a nonzero lower bound, have the same type if they have the same element type and rank, regardless of the lower bound on the array. Zero-dimensional arrays are not supported.