C# Type MakePointerType

Description

Type MakePointerType returns a Type object that represents a pointer to the current type.

Syntax

Type.MakePointerType has the following syntax.


public virtual Type MakePointerType()

Returns

Type.MakePointerType method returns A Type object that represents a pointer to the current type.

Example

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


//from   w  w w. ja va 2s  . c  o m

using System;
using System.Reflection;

public class Example
{
    public static void Main()
    {
        Type t = typeof(Example).MakeArrayType();
        t = typeof(Example).MakePointerType();
        Console.WriteLine("\r\nPointer to Example: {0}", 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