Array.CreateInstance Method (Type, Int32, Int32)
Assembly: mscorlib (in mscorlib.dll)
static member CreateInstance : elementType:Type * lengths:int * lowerBounds:int -> Array
- Type: System.Int32
A one-dimensional array that contains the size of each dimension of the Array to create.
elementType is a null reference (Nothing in Visual Basic).
lengths is a null reference (Nothing in Visual Basic).
lowerBounds is a null reference (Nothing in Visual Basic).
elementType is not a valid Type.
The lengths array contains less than one element.
The lengths and lowerBounds arrays do not contain the same number of elements.
elementType is not supported. For example, Void is not supported.
elementType is an open generic type.
Any value in lengths is less than zero.
Any value in lowerBounds is very large, such that the sum of a dimension's lower bound and length is greater than Int32.MaxValue.
The lengths and lowerBounds arrays must have the same number of elements. The number of elements in the lengths array must equal the number of dimensions in the new Array.
Each element of the lengths array must specify the length of the corresponding dimension in the new Array.
Each element of the lowerBounds array must specify the lower bound of the corresponding dimension in the new Array. Generally, the .NET Framework class library and many programming languages do not handle nonzero lower bounds.
Reference-type elements are initialized to a null reference (Nothing in Visual Basic). Value-type elements are initialized to zero.
This method is an O(n) operation, where n is the product of all values in lengths.