System.Runtime.CompilerServices.MethodImplOptions Enum

public enum MethodImplOptions

Base Types

Object
  ValueType
    Enum
      MethodImplOptions

Assembly

mscorlib

Library

RuntimeInfrastructure

Summary

Defines the details of how a method is implemented.

Description

This enumeration is used by MethodImplAttribute.

See Also

System.Runtime.CompilerServices Namespace

Members

MethodImplOptions Fields

MethodImplOptions.ForwardRef Field
MethodImplOptions.InternalCall Field
MethodImplOptions.NoInlining Field
MethodImplOptions.Synchronized Field
MethodImplOptions.Unmanaged Field
MethodImplOptions.value__ Field


MethodImplOptions.ForwardRef Field

ForwardRef = 16;

Summary

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. ]

See Also

System.Runtime.CompilerServices.MethodImplOptions Enum, System.Runtime.CompilerServices Namespace

MethodImplOptions.InternalCall Field

InternalCall = 4096;

Summary

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. System.Object.MemberwiseClone is an example of an internally called method.]

See Also

System.Runtime.CompilerServices.MethodImplOptions Enum, System.Runtime.CompilerServices Namespace

MethodImplOptions.NoInlining Field

NoInlining = 8;

Summary

Specifies that the method is not permitted to be inlined.

See Also

System.Runtime.CompilerServices.MethodImplOptions Enum, System.Runtime.CompilerServices Namespace

MethodImplOptions.Synchronized Field

Synchronized = 32;

Summary

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(System.Object) and System.Threading.Monitor.Exit(System.Object) statements locking the previous described object. This option and the 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 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.

]

See Also

System.Runtime.CompilerServices.MethodImplOptions Enum, System.Runtime.CompilerServices Namespace

MethodImplOptions.Unmanaged Field

Unmanaged = 4;

Summary

Specifies that the method is implemented in unmanaged code.

See Also

System.Runtime.CompilerServices.MethodImplOptions Enum, System.Runtime.CompilerServices Namespace

MethodImplOptions.value__ Field

value__;

See Also

System.Runtime.CompilerServices.MethodImplOptions Enum, System.Runtime.CompilerServices Namespace