System.Reflection.Emit.OpCodes.Ldobj Field

Copies the value type object pointed to by an address to the top of the evaluation stack.

Syntax

public static readonly OpCode Ldobj

Remarks

The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

71 < T >

ldobj class

Copy instance of value type class to the stack.

The stack transitional behavior, in sequential order, is:

[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]

The ldobj instruction is used to pass a value type as a parameter.

The ldobj instruction copies the value pointed to by addrOfValObj (of type &, *, or native int) to the top of the stack. The number of bytes copied depends on the size of the class (as specified by the class parameter). The class parameter is a metadata token representing the value type.

The operation of the ldobj instruction can be altered by an immediately preceding OpCodes.Volatile or OpCodes.Unaligned prefix instruction.

TypeLoadException is thrown if class cannot be found. This is typically detected when the Microsoft Intermediate Language (MSIL) instruction is converted to native code rather than at runtime.

The following ILGenerator.Emit(OpCode) method overload can use the ldobj opcode:

  • ILGenerator.Emit(OpCode, Type)

Requirements

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