MethodImplAttribute Class
Updated: September 2010
Specifies the details of how a method is implemented. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
You can apply this attribute to methods or constructors.
This attribute lets you customize the configuration of the method or constructor to which it applies. The members of the MethodImplOptions enumeration correspond to bit fields in the CorMethodImpl metadata table. This means that information on the attribute cannot be retrieved at run time by calling the MemberInfo::GetCustomAttributes method; instead, it is retrieved by calling either the MethodInfo.GetMethodImplementationFlags or the ConstructorInfo.GetMethodImplementationFlags method.
The following example applies the MethodImplAttribute to the GetCalendarName method to ensure that it is not inlined at run time by the just-in-time (JIT) compiler.
The following example then calls the MethodInfo.GetMethodImplementationFlags method to determine which flags are set for the GetCalendarName method. It also demonstrates that this information is not retrieved by the MemberInfo.GetCustomAttributes(System.Boolean) method.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.