The data type System.Type encapsulates a type. This data type is at the core of the reflection subsystem. It is a large data structure that contains many properties and methods. Type is derived from an abstract class called System.Reflection.MemberInfo. MemberInfo defines the following read-only properties.
|Type DeclaringType||This property obtains the type of the class or interface in which the member is declared.|
|MemberTypes MemberType||This property obtains the kind of the member. This value determines if the member is a field, method, property, event or constructor.|
|int MetadataToken||This property obtains a value linked to a specified piece of metadata.|
|Module Module||This property obtains the module in which the reflected type resides.|
|string Name||This property delivers the name of the type.|
|Type ReflectedType||The type of the object being reflected.|
MemberTypes is an enumeration that includes the following.
MemberTypes.Constructor MemberTypes.Method MemberTypes.Field MemberTypes.Event MemberTypes.Property
To the components of MemberInfo, the class Type adds a great many of its own. Several commonly used methods of Type are shown in the table below.
|ConstructorInfo GetConstructors()||Obtains a list of constructors for the type.|
|EventInfo GetEvents()||Obtains a list of events for the type.|
|FieldInfo GetFields()||Obtains a list of fields for the type.|
|Type GetGenericArguments()||Obtains a list of type arguments bound to a constructed generic type or type if the type is not constructed.|
|MemberInfo GetMembers()||Obtains a list of members for the type.|
|MethodInfo GetMethods||Obtains a list of methods for the type.|
|PropertyInfo GetProperties()||Obtains a list of properties for the type.|
Several commonly used read-only properties of Type are shown in the table below.
|Assembly Assembly||Obtains the assembly of the type.|
|TypeAttributes Attributes||Obtains the attributes for the type.|
|Type BaseType||Obtains the immediate base class of the type.|
|string FullName||Obtains the complete name of the type.|
|bool IsAbstract||Returns true when the type is abstract.|
|bool IsArray||Returns true when the type is an array.|
|bool IsClass||Returns true when the type is a class.|
|bool IsEnum||Returns true when the type is an enumeration.|
|bool IsGenericParameter||Retuns true when the type is a generic type parameter.|
|bool IsGenericTypeDefinition||Returns true when the type is an unconstructed generic type.|
|string Namespace||Returns the name space for the type.|