Marks a field as volatile. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
IsVolatile is used only in custom modifiers of method signatures to indicate that the field it marks is volatile. Any compiler that imports metadata with one or more fields marked as volatile must use instructions prefixed with volatile. to access such fields.
The classes in System.Runtime.CompilerServices are for compiler writers' use only.
Compilers emit custom modifiers within metadata to change the way that the just-in-time (JIT) compiler handles values when the default behavior is not appropriate. When the JIT compiler encounters a custom modifier, it handles the value in the way that the modifier specifies. Compilers can apply custom modifiers to methods, parameters, and return values. The JIT compiler must respond to required modifiers but can ignore optional modifiers. A C++ compiler could emit a custom modifier to describe how a byte should be treated in cases where the JIT compiler treats bytes in a manner that is not compatible with C++ by default.
You can emit custom modifiers into metadata using one of the following techniques:
Generating a Microsoft intermediate language (MSIL) instruction file that contains calls to modopt and modreq, and assembling the file with the Ilasm.exe (IL Assembler).
Using the unmanaged reflection API.
.NET FrameworkSupported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
XNA FrameworkSupported in: 3.0, 2.0, 1.0
Portable Class LibrarySupported in: Portable Class Library
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8