Using Reflection Emit
This section provides a description of the fundamental tasks that you can accomplish using reflection emit. The following notes apply to the task descriptions.
The MethodAttributes.SpecialName attribute applies to types (specified using the TypeAttributes enumeration), methods (specified using the MethodAttributes enumeration), fields (specified using the FieldAttributes enumeration), properties (specified using the PropertyAttributes enumeration), and events (specified using the EventAttributes enumeration).
The MethodAttributes.SpecialName attribute is used to specify that the name is special to compilers, tools, and so on. The common language runtime does not check this attribute.
The MethodAttributes.RTSpecialName attribute is reserved for use by the runtime only.
In This Section
Walkthrough: Emitting Code in Partial Trust Scenarios
Shows how to create and execute anonymously hosted dynamic methods from partially trusted code, and how to create an application domain for testing partially trusted code.How to: Define and Execute Dynamic Methods
Explains how to define a lightweight dynamic method, add MSIL, and execute the completed method without the overhead of defining a dynamic assembly.How to: Define a Generic Type with Reflection Emit
Shows how to define a generic type in a dynamic module, how to define its generic type parameters, and how to use them in method signatures.How to: Define a Generic Method with Reflection Emit
Shows how to define a generic method in a dynamic module, how to define its generic type parameters, and how to execute the method.Defining a Dynamic Assembly
Lists and describes the ways to create and use dynamic assemblies.How to: Use Full Signing to Give a Dynamic Assembly a Strong Name
Explains how to give a strong name to a dynamic assembly.Defining a Dynamic Module
Lists and describes the ways to create dynamic modules within dynamic assemblies.Defining a Type with Reflection Emit
Describes the ways types can be created, the attributes that can be used, and limitations of dynamic type creation.Defining an Enum with Reflection Emit
Lists the classes and methods used to define dynamic enumerations.Defining a Constructor with Reflection Emit
Describes the definition of constructors for dynamic classes, the attributes used, and limitations.Defining a Method with Reflection Emit
Describes the ways to define methods in dynamic modules and dynamic types, the attributes used, and limitations.Defining a Field with Reflection Emit
Lists the classes and methods used to define fields for dynamic types.Defining a Property with Reflection Emit
Lists the classes and methods used to define properties for dynamic types.Defining an Event with Reflection Emit
Lists the classes and methods used to define events for dynamic types.Defining a Parameter with Reflection Emit
Lists the classes and methods used to define parameters for methods of dynamic modules and types.Defining a String Constant with Reflection Emit
Lists the classes and methods used to define string constants.Emitting MSIL Instructions with Reflection Emit
Explains how to create executable code by emitting MSIL instructions into properties and methods.Emitting Declarative Security Attributes
Explains how to apply declarative security attributes to types and members in dynamic assemblies, and to dynamic assemblies themselves.Emitting Resources with Reflection Emit
Explains how to add resources to dynamic modules.Emitting Symbolic Information with Reflection Emit
Explains how to add symbolic information that can be used by debuggers and other tools.