MethodImplAttribute Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Specifies the details of how a method is implemented. This class cannot be inherited.


Namespace:  System.Runtime.CompilerServices
Assembly:  mscorlib (in mscorlib.dll)

[AttributeUsageAttribute(AttributeTargets.Constructor|AttributeTargets.Method, Inherited = false)]
public sealed class MethodImplAttribute : Attribute

The MethodImplAttribute type exposes the following members.

Public methodMethodImplAttribute()()()()Initializes a new instance of the MethodImplAttribute class.
Public methodMethodImplAttribute(Int16)Initializes a new instance of the MethodImplAttribute class with the specified MethodImplOptions value.
Public methodMethodImplAttribute(MethodImplOptions)Initializes a new instance of the MethodImplAttribute class with the specified MethodImplOptions value.

Public propertyValueGets the MethodImplOptions value describing the attributed method.

Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public fieldMethodCodeTypeA MethodCodeType value indicating what kind of implementation is provided for this method.

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 by supplying a MethodImplOptions value to its class constructor. 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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.