System.Reflection.Emit.ILGenerator.Emit Method

Puts the specified instruction onto the stream of instructions.


public virtual void Emit (OpCode opcode)


The Microsoft Intermediate Language (MSIL) instruction to be put onto the stream.


If the opcode parameter requires an argument, the caller must ensure that the argument length matches the length of the declared parameter. Otherwise, results will be unpredictable. For example, if the Emit instruction requires a 2-byte operand and the caller supplies a 4-byte operand, the runtime will emit two additional bytes to the instruction stream. These extra bytes will be OpCodes.Nop instructions.

The instruction values are defined in System.Reflection.Emit.OpCodes.


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