Arrays

An array is a data structure that contains a set of variables, which are accessed through calculated indices. The variables contained in an array, also named the elements of the array, are all of the same type. This type is named the element type of the array.

An array has a rank that determines the number of indices associated with each array element. The number of array dimensions is also referred to as the rank of the array. An array with a rank of one is named a single-dimensional array, an array with a rank greater than one is named a multi-dimensional array.

Each array dimension has an associated length that is an integral number greater than or equal to zero. Dimension length sets an acceptable range of indices for a given dimension. If no explicit limits are determined for the dimension, and only the length N is set, the indices may take values from 0 to N – 1 inclusive. For a dimension with the limits N..M, the indices may take values between N and M.

The total number of elements in an array is the product of the lengths of each dimension in the array. If one or more of the dimensions of an array have a length of zero, the array is said to be empty.

Array elements may have any type (including the array type).

Additional information is contained in the following subsections:

The System.Enum Type

The System.Enum type is an abstract parent class for all enumeration types and the members that inherit from System.Enum are available in the enumeration-type. A boxing conversion exists from any enumeration type to the System.Enum type, and an unboxing conversion exists from the System.Enum type to any enumeration type.

Note that the System.Enum type is not itself an enumeration type. It is a class type, from which all enumeration types are derived.

See also:

Description and Syntax Rules