System.Reflection.Emit.OpCodes.Volatile Field

Specifies that an address currently atop the evaluation stack might be volatile, and the results of reading that location cannot be cached or that multiple stores to that location cannot be suppressed.

Syntax

public static readonly OpCode Volatile

Remarks

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

FE 13

volatile.

Indicates that the subsequent pointer reference is volatile.

The stack transitional behavior, in sequential order, is:

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

volatile. specifies that the address is a volatile address (that is, it can be referenced externally to the current thread of execution) and the results of reading that location cannot be cached or that multiple stores to that location cannot be suppressed. Marking an access as volatile affects only that single access; other accesses to the same location must be marked separately. Access to volatile locations need not be performed atomically.

The OpCodes.Unaligned and volatile prefixes can be combined in either order. They must immediately precede a ldind, stind, ldfld, stfld, ldobj, stobj, initblk, or cpblk instruction. Only the volatile prefix is allowed for the OpCodes.Ldsfld and OpCodes.Stsfld instructions.

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

  • ILGenerator.Emit(OpCode)

Requirements

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