Partager via


ILGenerator.Emit Method (OpCode, Type)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given type.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Overridable Sub Emit ( _
    opcode As OpCode, _
    cls As Type _
)
[SecuritySafeCriticalAttribute]
public virtual void Emit(
    OpCode opcode,
    Type cls
)

Parameters

  • cls
    Type: System.Type
    The type that is the target of opcode.

Exceptions

Exception Condition
ArgumentNullException

cls is nulla null reference (Nothing in Visual Basic).

Remarks

The instruction values are defined in the OpCodes enumeration.

The location of cls is recorded so that the token can be patched if necessary when persisting the module to a portable executable (PE) file.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.