mscorlib 2.0.0.0 4.0.0.0 System.Object System.Runtime.InteropServices.ComVisible(true)

The class allows developers to write their own MSIL generators instead of using .

To create instances of other types, call methods, and so on, the MSIL you generate must include tokens for those entities. The class provides several overloads of the method, which return tokens valid in the scope of the current . For example, if you need to call an overload of the method, you can obtain a for that overload and pass it to the method to obtain a token to embed in your MSIL.

Once you have created arrays for your local variable signature, exceptions, and code body, you can use the , , and methods to insert them into the associated with your object.

Generating your own metadata and MSIL requires familiarity with the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

Do not use to generate code that creates a delegate to another dynamic method by calling the delegate constructor directly. Instead, use the method to create the delegate. A delegate that is created with the delegate constructor does not have a reference to the target dynamic method. The dynamic method might be reclaimed by garbage collection while the delegate is still in use.

Provides support for alternative ways to generate the Microsoft intermediate language (MSIL) and metadata for a dynamic method, including methods for creating tokens and for inserting the code, exception handling, and local variable signature blobs.

- Property
  2.0.0.0
  4.0.0.0
  System.Reflection.Emit.DynamicMethod To be added.

  A object is always associated with a dynamic method. The purpose of the class is to provide another way of inserting the MSIL stream, exception handling, and local variable signature into a dynamic method, for developers who want to generate MSIL without using the class.

  Gets the dynamic method whose body is generated by the current instance.

- Method
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  For information on signature blobs, see the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Gets a token, valid in the scope of the current , representing the signature for the associated dynamic method.

  A token that can be embedded in the metadata and the MSIL stream for the associated dynamic method.

  An array that contains the signature.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  The token returned by this method overload allows you to call a dynamic method from the dynamic method associated with the current object. To call the associated dynamic method recursively, pass the value of the property.

  Gets a token, valid in the scope of the current , representing a dynamic method to be called from the associated method.

  A token that can be embedded in the MSIL stream for the associated dynamic method, as the target of an MSIL instruction.

  The dynamic method to call.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  You must obtain a token for any field that will be accessed by the dynamic method associated with the current object. Use the method to get a for the field you want to access, then use the property to get the .

  Gets a token, valid in the scope of the current , representing a field to be accessed from the associated dynamic method.

  A token that can be used as the operand of an MSIL instruction that accesses fields, in the scope of the current object.

  The field to be accessed.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  You must obtain a token for any method that will be accessed by the dynamic method associated with the current object. Use the method to get a for the method you want to access, and then use the property to get the .

  For a method that belongs to a generic type, use the method overload and specify a for the generic type.

  Gets a token, valid in the scope of the current , representing a method to be accessed from the associated dynamic method.

  A token that can be used as the operand of an MSIL instruction that accesses methods, such as or , in the scope of the current object.

  The method to be accessed.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  The token returned by this method overload allows you to define a local variable type, and emit MSIL to create an instance of a type in the dynamic method associated with the current object.

  To get a representing a type, use the property.

  Gets a token, valid in the scope of the current , representing a type to be used in the associated dynamic method.

  A token that can be used as the operand of an MSIL instruction that requires a type, in the scope of the current object.

  The type to be used.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` To be added.

  Gets a token, valid in the scope of the current , representing a string literal to be used in the associated dynamic method.

  A token that can be used as the operand of an MSIL instruction that requires a string, in the scope of the current object.

  The string to be used.
- Method
  4.0.0.0
  System.Int32 `` ``

  You must obtain a token for any field that will be accessed by the dynamic method associated with the current object. Use the method to get a for the field you want to access, and then use the property to get the .

  Gets a token, valid in the scope of the current , representing a field to be accessed from the associated dynamic method; the field is on the specified generic type.

  A token that can be used as the operand of an MSIL instruction that accesses fields in the scope of the current object.

  The field to be accessed. The generic type the field belongs to.
- Method
  2.0.0.0
  4.0.0.0
  System.Int32 `` ``

  You must obtain a token for any method that will be called by the dynamic method associated with the current object. Use the method to get a for the method you want to call, and then use the property to get the .

  Gets a token, valid in the scope of the current , representing a method on a generic type.

  A token that can be used as the operand of an MSIL instruction that accesses methods, such as or , in the scope of the current object.

  The method. The generic type the method belongs to.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  No validity checks are performed on the MSIL stream.

  Calling this method a second time replaces the first MSIL stream with the second.

  Generating your own metadata and MSIL requires familiarity with the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Sets the code body of the associated dynamic method.

  An array that contains the MSIL stream. The maximum number of items on the operand stack when the method is executing.
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Void `` `` ``

  No validity checks are performed on the MSIL stream.

  Calling this method a second time replaces the first MSIL stream with the second.

  Generating your own metadata and MSIL requires familiarity with the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set." The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Sets the code body of the associated dynamic method.

  A pointer to a byte array containing the MSIL stream. The number of bytes in the MSIL stream. The maximum number of items on the operand stack when the method is executing.
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  The exception metadata for a method defines the location and size of all try, catch, finally, filter, and fault blocks. For information on the layout of this metadata, see the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Sets the exception metadata for the associated dynamic method.

  An array that contains the exception metadata.
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Void `` ``

  The exception metadata for a method defines the location and size of all try, catch, finally, filter, and fault blocks. For information on the layout of this metadata, see the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Sets the exception metadata for the associated dynamic method.

  A pointer to a byte array containing the exception metadata. The number of bytes of exception metadata.
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  The local variable signature describes the layout of a method's local variables. To simplify construction of the local variable signature, use the static (Shared in Visual Basic) method to get a for the local signature.

  For information on local variable signatures, see the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Sets the local variable signature that describes the layout of local variables for the associated dynamic method.

  An array that contains the layout of local variables for the associated .
- Method
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Void `` ``

  The local variable signature describes the layout of a method's local variables. To simplify construction of the local variable signature, use the static (Shared in Visual Basic) method to get a for the local signature.

  For information on local variable signatures, see the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Sets the local variable signature that describes the layout of local variables for the associated dynamic method.

  An array that contains the layout of local variables for the associated . The number of bytes in the signature.