Click or drag to resize
ArrayCreateInstance Method (Type, Int32)
Creates a one-dimensional Array of the specified Type and length, with zero-based indexing.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static Array CreateInstance(
	Type elementType,
	int length
)

Parameters

elementType
Type: SystemType
The Type of the Array to create.
length
Type: SystemInt32
The size of the Array to create.

Return Value

Type: Array
A new one-dimensional Array of the specified Type with the specified length, using zero-based indexing.
Exceptions
ExceptionCondition
ArgumentNullExceptionelementType is null.
ArgumentExceptionelementType is not a valid Type.
NotSupportedExceptionelementType is not supported. For example, Void is not supported.-or-elementType is an open generic type.
ArgumentOutOfRangeExceptionlength is less than zero.
See Also