[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Represents type declarations: class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|Assembly||Gets the Assembly in which the type is declared. For generic types, gets the Assembly in which the generic type is defined.|
|AssemblyQualifiedName||Gets the assembly-qualified name of the , which includes the name of the assembly from which the was loaded.|
|BaseType||Gets the type from which the current directly inherits.|
|DeclaringType||Gets the type that declares the current nested type or generic type parameter. (Overrides MemberInfo..::..DeclaringType.)|
|FullName||Gets the fully qualified name of the , including the namespace of the but not the assembly.|
|IsAbstract||Gets a value indicating whether the is abstract and must be overridden.|
|IsArray||Gets a value indicating whether the is an array.|
|IsClass||Gets a value indicating whether the is a class; that is, not a value type or interface.|
|IsEnum||Gets a value indicating whether the current represents an enumeration.|
|IsInterface||Gets a value indicating whether the is an interface; that is, not a class or a value type.|
|IsNotPublic||Gets a value indicating whether the is not declared public.|
|IsPublic||Gets a value indicating whether the is declared public.|
|IsSerializable||Gets a value indicating whether the is serializable.|
|IsValueType||Gets a value indicating whether the is a value type.|
|MemberType||When overridden in a derived class, gets a MemberTypes value indicating the type of the member — method, constructor, event, and so on. (Inherited from MemberInfo.)|
|Name||Gets the name of the current member. (Inherited from MemberInfo.)|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetConstructor||Searches for a public instance constructor whose parameters match the types in the specified array.|
|GetElementType||When overridden in a derived class, returns the of the object encompassed or referred to by the current array, pointer or reference type.|
|GetField(String)||Searches for the public field with the specified name.|
|GetField(String, BindingFlags)||Searches for the specified field, using the specified binding constraints.|
|GetFields()()()()||Returns all the public fields of the current .|
|GetFields(BindingFlags)||When overridden in a derived class, searches for the fields defined for the current , using the specified binding constraints.|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetInterfaces||When overridden in a derived class, gets all the interfaces implemented or inherited by the current .|
|GetMethod(String)||Searches for the public method with the specified name.|
|GetMethod(String, BindingFlags)||Searches for the specified method, using the specified binding constraints.|
|GetMethod(String, array<Type>())||Searches for the specified public method whose parameters match the specified argument types.|
|GetMethods()()()()||Returns all the public methods of the current .|
|GetMethods(BindingFlags)||When overridden in a derived class, searches for the methods defined for the current , using the specified binding constraints.|
|GetType()()()()||Gets the of the current instance. (Inherited from Object.)|
|GetType(String)||Gets the with the specified name, performing a case-sensitive search.|
|GetTypeFromHandle||Gets the type referenced by the specified type handle.|
|InvokeMember||Invokes the specified member, using the specified binding constraints and matching the specified argument list.|
|IsInstanceOfType||Determines whether the specified object is an instance of the current .|
|IsSubclassOf||Determines whether the class represented by the current derives from the class represented by the specified .|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a String representing the name of the current Type. (Overrides Object..::..ToString()()()().)|
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.
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 comparison of Type objects using reference equality.
No permissions are required for code to use reflection to get information about types and their members, regardless of their access levels. No permissions are required for code to use reflection to access public members, or other members whose access levels would make them visible during normal compilation. However, in order for your code to use reflection to access members that would normally be inaccessible, such as private or internal methods, or protected fields of a type your class does not inherit, your code must have . See Security Considerations for Reflection.
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.
In multithreading scenarios, do not lock objects in order to synchronize access to static data. Other code, over which you have no control, might also lock your class type. This might result in a deadlock. Instead, synchronize access to static data by locking a private static object.
This class is thread safe; multiple threads can concurrently read from an instance of this type. An instance of Type can represent any of the following types:
Constructed generic types and generic type definitions
Type arguments and type parameters of constructed generic types, generic type definitions, and generic method definitions
A reference to the Type object associated with a type can be obtained in the following ways:
The Object..::..GetType method returns a Type object that represents the type of an instance.
The static GetType methods return a Type object that represents a type specified by its fully qualified name.
The , , and methods return Type objects that represent the types defined in a module. The first method can be used to obtain an array of Type objects for all the public and private types defined in a module. (You can obtain an instance of Module through the or method, or through the property.)
The method returns a filtered list of interface types supported by a type.
The GetElementType method returns a Type object that represents the element.
The GetInterfaces and methods return Type objects representing the interface types supported by a type.
The method returns an array of Type objects representing the types specified by an arbitrary set of objects. The objects are specified with an array of type Object.
The and methods are provided for COM interoperability. They return a Type object that represents the type specified by a ProgID or CLSID.
The GetTypeFromHandle method is provided for interoperability. It returns a Type object that represents the type specified by a class handle.
The C# typeof operator, the C++ typeid operator, and the Visual Basic GetType operator obtain the Type object for a type.
The method returns a object representing a constructed generic type, which is an open constructed type if its property returns true, and a closed constructed type otherwise. A generic type can be instantiated only if it is closed.
The , , and methods return objects that represent, respectively, an array of a specified type, a pointer to a specified type, and the type of a reference parameter (ref in C#, ByRef in Visual Basic).