Mono Class Library: System.Runtime.CompilerServices Namespace

System.Runtime.CompilerServices.MethodImplOptions Enumeration

Defines the details of how a method is implemented. [Edit]
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
public enum MethodImplOptions

Remarks

This enumeration is used by System.Runtime.CompilerServices.MethodImplAttribute. [Edit]

Members

Member NameDescription
ForwardRef

Specifies that the method is declared, but its implementation is provided elsewhere.

Note: For most languages, it is recommended that the notion of "forward" be attached to methods using language syntax instead of custom attributes.

[Edit]
InternalCall

Specifies an internal call.

Note: An internal call is a call to a method implemented within the system itself, providing additional functionality that regular managed code cannot provide. object.MemberwiseClone is an example of an internally called method.

[Edit]
NoInliningSpecifies that the method is not permitted to be inlined. [Edit]
PreserveSigDocumentation for this section has not yet been entered. [Edit]
Synchronized

Specifies the method can be executed by only one thread at a time.

This option specifies that before a thread can execute the target method, the thread is required to acquire a lock on either the current instance or the Type object for the method's class. If the target method is an instance method, the lock is on the current instance. If the target is a static method, the lock is on the Type object. Specifying this option causes the target method to behave as though its statements are enclosed by System.Threading.Monitor.Enter(object) and System.Threading.Monitor.Exit(object) statements locking the previous described object. This option and the System.Threading.Monitor methods are functionally equivalent, and both are functionally equivalent to enclosing the target method's code in a C# lock (this) statement.

Note:

Because this option holds the lock for the duration of the target method, it should be used only when the entire method must be single threaded. Use the System.Threading.Monitor methods (or the C# lock statement) if the object lock can be taken after the method begins, or released before the method ends. Any mechanism that uses locks can cause an application to experience deadlocks and performance degradation; for these reasons, use this option with care.

For most languages, it is recommended that the notion of "synchronized" be attached to methods using language syntax instead of custom attributes.

[Edit]
UnmanagedSpecifies that the method is implemented in unmanaged code. [Edit]

Requirements

Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0