Mega Code Archive

 
Categories / C# Book / 09 Reflection
 

0617 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*