This documentation is archived and is not being maintained.

MethodImplAttributes Enumeration

Specifies flags for the attributes of a method implementation.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration MethodImplAttributes
Dim instance As MethodImplAttributes

/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum MethodImplAttributes
public enum MethodImplAttributes

 Member nameDescription
Supported by the .NET Compact FrameworkCodeTypeMaskSpecifies flags about code type. 
Supported by the .NET Compact FrameworkForwardRefSpecifies that the method is not defined. 
Supported by the .NET Compact FrameworkILSpecifies that the method implementation is in Microsoft intermediate language (MSIL). 
Supported by the .NET Compact FrameworkInternalCallSpecifies an internal call. 
Supported by the .NET Compact FrameworkManagedSpecifies that the method implementation is managed, otherwise unmanaged. 
Supported by the .NET Compact FrameworkManagedMaskSpecifies whether the code is managed or unmanaged. 
Supported by the .NET Compact FrameworkMaxMethodImplValSpecifies a range check value. 
Supported by the .NET Compact FrameworkNativeSpecifies that the method implementation is native. 
Supported by the .NET Compact FrameworkNoInliningSpecifies that the method cannot be inlined. 
Supported by the .NET Compact FrameworkOPTILSpecifies that the method implementation is in Optimized Intermediate Language (OPTIL). 
Supported by the .NET Compact FrameworkPreserveSigSpecifies that the method signature is exported exactly as declared. 
Supported by the .NET Compact FrameworkRuntimeSpecifies that the method implementation is provided by the runtime. 
Supported by the .NET Compact FrameworkSynchronizedSpecifies that the method is single-threaded through the body. Static methods (Shared in Visual Basic) lock on the type, while instance methods lock on the instance. You can also use the C# lock Statement (C# Programmers Reference) or the Visual Basic Lock, Unlock Functions for this purpose.  
Supported by the .NET Compact FrameworkUnmanagedSpecifies that the method implementation is unmanaged, otherwise managed. 

The attributes are combined using the bitwise OR operation as follows:

Code Implementation Masks

  • CodeTypeMask

  • IL

  • Native


  • Runtime

Managed Masks

  • ManagedMask

  • Unmanaged

  • Managed

Implementation Information and Interop Masks

  • ForwardRef

  • PreserveSig

  • InternalCall

  • Synchronized

  • NoInlining

  • MaxMethodImplVal


Locking on the instance or on the type, as with the Synchronized flag, is not recommended for public types because code other than your own can take locks on public types and instances. This might cause deadlocks or other synchronization problems.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0