C# Type MakeArrayType()

Description

Type MakeArrayType() returns a Type object representing a one-dimensional array of the current type, with a lower bound of zero.

Syntax

Type.MakeArrayType() has the following syntax.


public virtual Type MakeArrayType()

Returns

Type.MakeArrayType() method returns A Type object representing a one-dimensional array of the current type, with a lower bound of zero.

Example

The following code example creates array, ref (ByRef in Visual Basic), and pointer types for the Test class.


//from ww  w  .j  av a  2s  .  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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version