Mega Code Archive

 
Categories / C# Book / 09 Reflection
 

0611 Type properties

You can use System.Type object to access the type's name, assembly, base type, visibility, and so on. For example: using System; using System.Reflection; using System.Collections.Generic; class MainClass { static void Main() { Type stringType = typeof(String); string name = stringType.Name; // String Type baseType = stringType.BaseType; // typeof(Object) Assembly assem = stringType.Assembly; // mscorlib.dll bool isPublic = stringType.IsPublic; // true } }