A commonly used family of types consists of arrays, which really are a form of type constructors: given any type, you can construct an array type out of it. To facilitate certain common operations, the
System.Array type exists. All arrays derive from this type, giving them some useful instance-level members and properties. For example, the rank of an array denotes the number of dimensions:
var xs = new int;var ys = new int[3,4];var zs = new int;
For the first array, the rank will be
1 because there’s only one dimension. The second one has a rank of
2 because of the use of the multidimensional array feature. For the last one, a jagged array, the rank of
zs is still
Console.WriteLine(xs.Rank); // 1Console.WriteLine(ys.Rank); ...