Array.CreateInstance Method (Type, Int32, Int32)
December 03, 2013
Assembly: mscorlib (in mscorlib.dll)
public static Array CreateInstance( Type elementType, int lengths, int lowerBounds )
A one-dimensional array that contains the size of each dimension of the Array to create.
elementType is null.
lengths is null.
lowerBounds is null.
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 null. Value-type elements are initialized to zero.
This method is an O(n) operation, where n is the product of all values in lengths.