Reflection
The classes in the System.Reflection namespace, together with System.Type, allow you to obtain information about loaded assemblies and the types defined within them, such as classes, interfaces, and value types. You can also use reflection to create type instances at run time, and to invoke and access them.
In This Section
- Reflection Overview
-
Explains reflection and its main uses.
- How to: Load Assemblies into the Reflection-Only Context
-
Describes the reflection-only load context. Shows how to load an assembly, how to test the context, and how to examine attributes applied to an assembly in the reflection-only context.
- Runtime Types in Reflection
-
Describes the internal types, such as RuntimeType, that inherit the abstract classes in the System.Reflection namespace and provide much of their implementation.
- Viewing Type Information
-
Describes the System.Type class and provides code examples that illustrate how to use System.Type with several reflection classes to obtain information about constructors, methods, fields, properties, and events.
- Reflection and Generic Types
-
Explains how reflection handles the type parameters and type arguments of generic types and generic methods.
- Design Patterns Used by Reflection Classes
-
Provides a table showing the method naming pattern and use of the most frequently used reflection classes, such as the Module, Type, and MemberInfo classes.
- Security Considerations for Reflection
-
Describes the rules that determine to what degree reflection can be used to discover type information and access types.
- Dynamically Loading and Using Types
-
Describes the reflection custom-binding interface that supports late binding.
- Accessing Default Members
-
Demonstrates how to use reflection to access default members that a class might have.
- Accessing Default Argument Values
-
Demonstrates how to use reflection to access arguments that have default values, and how to invoke methods that have arguments with default values.
- Accessing Custom Attributes
-
Demonstrates using reflection to query attribute existence and values.
- Specifying Fully Qualified Type Names
-
Describes the format of fully qualified type names in terms of the Backus-Naur form (BNF), and the syntax required for specifying special characters, assembly names, pointers, references, and arrays.
- Unmanaged Reflection API
-
Describes where to find information on using unmanaged reflection to examine metadata.
- How to: Hook Up a Delegate Using Reflection
-
Explains how to create a delegate for a method and hook the delegate up to an event. Explains how to create an event-handling method at run time using DynamicMethod.
Reference
- Type
-
The class that represents types in the runtime type system and provides core functionality for reflection.
- System.Reflection
-
The namespace that contains other abstractions for code entities, such as the MethodInfo class that represents methods.
- System.Reflection.Emit
-
The namespace that contains classes for generating dynamic assemblies and dynamic methods.