.NET Framework Class Library  

Type Class

Represents type declarations: class types, interface types, array types, value types, and enumeration types.

For a list of all members of this type, see Type Members.

System.Object
   System.Reflection.MemberInfo
      System.Type
         System.Reflection.Emit.EnumBuilder
         System.Reflection.Emit.TypeBuilder
         System.Reflection.TypeDelegator

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDual)>
MustInherit Public Class Type
   Inherits MemberInfo
   Implements IReflect
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDual)]
public abstract class Type : MemberInfo, IReflect
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDual)]
public __gc __abstract class Type : public MemberInfo, IReflect
[JScript]
public
   Serializable
   ClassInterface(ClassInterfaceType.AutoDual)
abstract class Type extends MemberInfo implements IReflect

Thread Safety

This type is safe for multithreaded operations.

Remarks

Type is the root of the System.Reflection functionality and is the primary way to access metadata. Use the members of Type to get information about a type declaration, such as the constructors, methods, fields, properties, and events of a class, as well as the module and the assembly in which the class is deployed.

Without ReflectionPermission, code can access only the public members of loaded assemblies. This includes, but is not limited to, unrestricted access to Object.GetType, access to public exported types through Type.GetType, and access to GetTypeFromHandle. Some properties of Type, such as FullName and Attributes, are accessible without ReflectionPermission.

Type is an abstract base class that allows multiple implementations. The system will always provide the derived class RuntimeType. In reflection, all classes beginning with the word Runtime are created only once per object in the system and support comparison operations.

Notes to Inheritors:  When you inherit from Type, you must override the following members: GUID, InvokeMember(String, BindingFlags, Binder, Object, Object, ParameterModifier, CultureInfo, String), Module, Assembly, TypeHandle, FullName, Namespace, AssemblyQualifiedName, BaseType, GetConstructorImpl, GetConstructors(BindingFlags), GetMethodImpl, GetMethods(BindingFlags), GetField(String, BindingFlags), GetFields(BindingFlags), GetInterface(String, Boolean), GetInterfaces, GetEvent(String, BindingFlags), GetEvents(BindingFlags), GetPropertyImpl, GetProperties(BindingFlags), GetNestedType(String, BindingFlags), GetNestedTypes(BindingFlags), GetAttributeFlagsImpl, IsArrayImpl, IsByRefImpl, IsPointerImpl, IsPrimitiveImpl, IsCOMObjectImpl, GetElementType, HasElementTypeImpl, UnderlyingSystemType, MemberInfo.Name, MemberInfo.IsDefined, System.Reflection.MemberInfo.GetCustomAttributes(Boolean), and System.Reflection.MemberInfo.GetCustomAttributes(Type, Boolean).

A Type object that represents a type is unique; that is, two Type object references refer to the same object if and only if they represent the same type. This allows for the synchronization of multiple static method invocations and for comparison of Type objects using reference equality.

This class is thread safe; multiple threads can concurrently read from or write to an instance of this type. An instance of Type can represent any of the following types:

A reference to the Type object associated with a type can be obtained in the following ways.

Note    A derived class can access protected members of the calling code's base classes. Also, access is allowed to assembly members of the calling code's assembly. As a rule, if you are allowed access in early bound code, then you are also allowed access in late bound code.
Note    Interfaces that extend other interfaces do not inherit the methods defined in the extended interfaces.

Requirements

Namespace: System

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET

Assembly: Mscorlib (in Mscorlib.dll)

See Also

Type Members | System Namespace | Object | System.Reflection | ReflectionPermission