
Use PropertyInfo to discover information such as the name, data type, declaring type, reflected type, and read-only or writable status of a property, and to get or set property values. Use EventInfo to discover information such as the name, event-handler data type, custom attributes, declaring type, and reflected type of an event, and to add or remove event handlers. Use FieldInfo to discover information such as the name, access modifiers (such as public or private) and implementation details (such as static) of a field, and to get or set field values. Use the GetMethods or GetMethod method of a Type to invoke a specific method. Use MethodInfo to discover information such as the name, return type, parameters, access modifiers (such as public or private), and implementation details (such as abstract or virtual) of a method. Use the GetConstructors or GetConstructor method of a Type to invoke a specific constructor. Use ConstructorInfo to discover information such as the name, parameters, access modifiers (such as public or private), and implementation details (such as abstract or virtual) of a constructor. You can also get all global methods or other specific, non-global methods defined on the module. Use Module to discover information such as the assembly that contains the module and the classes in the module. Use Assembly to define and load assemblies, load modules that are listed in the assembly manifest, and locate a type from this assembly and create an instance of it. Typical uses of reflection include the following: You can then invoke the type's methods or access its fields and properties. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object. Reflection provides objects that encapsulate assemblies, modules, and types. This management includes loading each assembly into the appropriate application domain and controlling the memory layout of the type hierarchy within each assembly.Īssemblies contain modules, modules contain types, and types contain members. The common language runtime loader manages application domains, which constitute defined boundaries around objects that have the same application scope.

For topics about specific aspects of reflection, see Related Topics at the end of this overview. You can also use reflection to create type instances at run time, and to invoke and access them. The classes in the System.Reflection namespace, together with System.Type, enable you to obtain information about loaded assemblies and the types defined within them, such as classes, interfaces, and value types (that is, structures and enumerations).
