OpCodes.Stind_Ref Field

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Stores a object reference value at a supplied address.

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


Public Shared ReadOnly Stind_Ref As OpCode
public static readonly OpCode Stind_Ref


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


Assembly Format




Stores an object reference (type O) value at a given address.

The stack transitional behavior, in sequential order, is:

  1. An address is pushed onto the stack.

  2. A value is pushed onto the stack.

  3. The value and the address are popped from the stack; the value is stored at the address.

The stind.ref instruction stores an object reference value at the supplied address (type native int, *, or &).

Type safe operation requires that the stind.ref instruction be used in a manner consistent with the type of the pointer. The operation of the stind.ref instruction can be altered by an immediately preceding Volatile or Unaligned prefix instruction.

NullReferenceException is thrown if addr is not naturally aligned for the argument type implied by the instruction suffix.

The following Emit method overload can use the stind.ref opcode:

  • ILGenerator.Emit(OpCode)

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1


Windows Phone

See Also


OpCodes Class

System.Reflection.Emit Namespace