System.Reflection.Emit.ILGenerator.Emit Method

Puts the specified instruction onto the stream of instructions.

Syntax

public virtual void Emit (OpCode opcode)

Parameters

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

Remarks

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.

Requirements

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