C# Type MakeArrayType(Int32)
Description
Type MakeArrayType(Int32)
returns a Type object representing
an array of the current type, with the specified number of dimensions.
Syntax
Type.MakeArrayType(Int32)
has the following syntax.
public virtual Type MakeArrayType(
int rank
)
Parameters
Type.MakeArrayType(Int32)
has the following parameters.
rank
- The number of dimensions for the array. This number must be less than or equal to 32.
Returns
Type.MakeArrayType(Int32)
method returns An object representing an array of the current type, with the specified number
of dimensions.
Example
The following code example creates array, ref (ByRef in Visual Basic), and pointer types for the Test class.
/* www .j a v a 2 s. c o m*/
using System;
using System.Reflection;
public class Example
{
public static void Main()
{
Type t = typeof(Example).MakeArrayType();
t = typeof(Example).MakeArrayType(2);
Console.WriteLine(t);
}
}
The code above generates the following result.