See Also: IsLong Members
The C++ standard indicates that a long value and an integer value are distinct types. However, they are both represented using ELEMENT_TYPE_I4 in an assembly. To distinguish a long from an integer in C++, the Microsoft C++ compiler adds the System.Runtime.CompilerServices.IsLong modifier to any instance of a long when the instance is emited. This process is critically important for maintaining language-level type safety.
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.
You can emit custom modifiers into metadata using one of the following techniques:
Using methods in the System.Reflection.Emit.TypeBuilder class such as erload:System.Reflection.Emit.TypeBuilder.DefineMethod, erload:System.Reflection.Emit.TypeBuilder.DefineField, erload:System.Reflection.Emit.TypeBuilder.DefineConstructor, and erload:System.Reflection.Emit.TypeBuilder.DefineProperty.
Generating a Microsoft intermediate language (MSIL) instruction file that contains calls to modopt and modreq, and assembling the file with the MSIL Assembler (Ilasm.exe).
Using the unmanaged reflection API.