System.Array
itself is abstract, so you won't be able to instantiate it using its constructor. And as evidenced by your error, it's not actually generic either; it only gets its type through implementing generic collection interfaces at runtime (see also this related answer):
Important
In the .NET Framework version 2.0, the Array class implements the System.Collections.Generic.IList<T>
, System.Collections.Generic.ICollection<T>
, and System.Collections.Generic.IEnumerable<T>
generic interfaces. The implementations are provided to arrays at run time, and therefore are not visible to the documentation build tools.
For the above reasons, the System.Array
class provides a convenience method called CreateInstance()
which you can use instead:
var array = Array.CreateInstance(typeof(int), 3);
Remarks
Unlike most classes, Array
provides the CreateInstance
method, instead of public constructors, to allow for late bound access.
Be very careful when using this method, though, as the resultant array
will not be strongly-typed at compile-time! If you want it to be strongly-typed you must cast it after creating it (and no, simply declaring int[] array
won't be enough):
var array = (int[]) Array.CreateInstance(typeof(int), 3);