MethodBase.GetMethodImplementationFlags 方法

当在派生类中重写时,返回 MethodImplAttributes 标志。

**命名空间:**System.Reflection
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public MustOverride Function GetMethodImplementationFlags As MethodImplAttributes
用法
Dim instance As MethodBase
Dim returnValue As MethodImplAttributes

returnValue = instance.GetMethodImplementationFlags
public abstract MethodImplAttributes GetMethodImplementationFlags ()
public:
virtual MethodImplAttributes GetMethodImplementationFlags () abstract
public abstract MethodImplAttributes GetMethodImplementationFlags ()
public abstract function GetMethodImplementationFlags () : MethodImplAttributes

返回值

MethodImplAttributes 标志。

示例

' Define a constructor of the dynamic class.
Dim myConstructorBuilder As ConstructorBuilder = _ 
    myTypeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, _ 
                                    myConstructorArgs)
' Get a reference to the module that contains this constructor.
Dim myModule As [Module] = myConstructorBuilder.GetModule()
Console.WriteLine("Module Name : " + myModule.Name)
' Get the 'MethodToken' that represents the token for this constructor.
Dim myMethodToken As MethodToken = myConstructorBuilder.GetToken()
Console.WriteLine("Constructor Token is : " + myMethodToken.Token.ToString())
' Get the method implementation flags for this constructor.
Dim myMethodImplAttributes As MethodImplAttributes = _
    myConstructorBuilder.GetMethodImplementationFlags()
Console.WriteLine("MethodImplAttributes : " + myMethodImplAttributes.ToString())
// Define a constructor of the dynamic class.
ConstructorBuilder myConstructorBuilder = myTypeBuilder.DefineConstructor(
   MethodAttributes.Public, CallingConventions.Standard, myConstructorArgs);
// Get a reference to the module that contains this constructor.
Module myModule = myConstructorBuilder.GetModule();
Console.WriteLine("Module Name : " + myModule.Name);
// Get the 'MethodToken' that represents the token for this constructor.
MethodToken myMethodToken = myConstructorBuilder.GetToken();
Console.WriteLine("Constructor Token is : " + myMethodToken.Token);
// Get the method implementation flags for this constructor.
MethodImplAttributes myMethodImplAttributes = myConstructorBuilder.GetMethodImplementationFlags();
Console.WriteLine("MethodImplAttributes : "  + myMethodImplAttributes);
// Define a constructor of the dynamic class.
ConstructorBuilder^ myConstructorBuilder = myTypeBuilder->DefineConstructor(
   MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs );
// Get a reference to the module that contains this constructor.
Module^ myModule = myConstructorBuilder->GetModule();
Console::WriteLine( "Module Name : {0}", myModule->Name );
// Get the 'MethodToken' that represents the token for this constructor.
MethodToken myMethodToken = myConstructorBuilder->GetToken();
Console::WriteLine( "Constructor Token is : {0}", myMethodToken.Token );
// Get the method implementation flags for this constructor.
MethodImplAttributes myMethodImplAttributes = myConstructorBuilder->GetMethodImplementationFlags();
Console::WriteLine( "MethodImplAttributes : {0}", myMethodImplAttributes );
// Define a constructor of the dynamic class.
ConstructorBuilder myConstructorBuilder =
    myTypeBuilder.DefineConstructor(MethodAttributes.Public,
    CallingConventions.Standard, myConstructorArgs);

// Get a reference to the module that contains this constructor.
Module myModule = myConstructorBuilder.GetModule();
Console.WriteLine("Module Name : " + myModule.get_Name());

// Get the 'MethodToken' that represents the token for this constructor.
MethodToken myMethodToken = myConstructorBuilder.GetToken();
Console.WriteLine("Constructor Token is : " + myMethodToken.get_Token());

// Get the method implementation flags for this constructor.
MethodImplAttributes myMethodImplAttributes =
    myConstructorBuilder.GetMethodImplementationFlags();
Console.WriteLine("MethodImplAttributes : " + myMethodImplAttributes);

.NET Framework 安全性

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

MethodBase 类
MethodBase 成员
System.Reflection 命名空间
MethodImplAttributes