Array and pointer type names

Arrays present with the same suffix that you use in a typeof expression:


using System;
using System.Reflection;
using System.Collections.Generic;

class MainClass
{
    static void Main()
    {
        Console.WriteLine(typeof(int[]).Name);  // Int32[] 
        Console.WriteLine (typeof ( int[,] ).Name); // Int32[,] 
        Console.WriteLine (typeof ( int[,] ).FullName);  // System.Int32[,]

    }

}

The output:


Int32[]
Int32[,]
System.Int32[,]

Pointer types are similar:


using System;
using System.Reflection;
using System.Collections.Generic;

class MainClass
{
    static void Main()
    {
        Console.WriteLine(typeof(byte*).Name);  // Byte*


    }

}

The output:


Byte*
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.