このコンストラクタのメソッド実装フラグを返します。
Overrides Public Function GetMethodImplementationFlags() As _
MethodImplAttributes
[C#]
public override MethodImplAttributes GetMethodImplementationFlags();
[C++]
public: MethodImplAttributes GetMethodImplementationFlags();
[JScript]
public override function GetMethodImplementationFlags() :
MethodImplAttributes;
戻り値
このコンストラクタのメソッド実装フラグ。
解説
GetMethodImplementationFlags の使用方法については、次のコード例を参照してください。
Dim myMethodBuilder As MethodBuilder = Nothing
Dim myCurrentDomain As AppDomain = AppDomain.CurrentDomain
' Create assembly in current CurrentDomain.
Dim myAssemblyName As New AssemblyName()
myAssemblyName.Name = "TempAssembly"
' Create a dynamic assembly.
myAssemblyBuilder = _
myCurrentDomain.DefineDynamicAssembly(myAssemblyName, AssemblyBuilderAccess.Run)
' Create a dynamic module in the assembly.
myModuleBuilder = myAssemblyBuilder.DefineDynamicModule("TempModule")
' Create a type in the module.
Dim myTypeBuilder As TypeBuilder = _
myModuleBuilder.DefineType("TempClass", TypeAttributes.Public)
Dim myGreetingField As FieldBuilder = _
myTypeBuilder.DefineField("Greeting", GetType(String), FieldAttributes.Public)
Dim myConstructorArgs As Type() = {GetType(String)}
' 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())
[C#]
MethodBuilder myMethodBuilder = null;
AppDomain myCurrentDomain = AppDomain.CurrentDomain;
// Create assembly in current CurrentDomain.
AssemblyName myAssemblyName = new AssemblyName();
myAssemblyName.Name = "TempAssembly";
// Create a dynamic assembly.
myAssemblyBuilder = myCurrentDomain.DefineDynamicAssembly
(myAssemblyName, AssemblyBuilderAccess.Run);
// Create a dynamic module in the assembly.
myModuleBuilder = myAssemblyBuilder.DefineDynamicModule("TempModule");
// Create a type in the module.
TypeBuilder myTypeBuilder = myModuleBuilder.DefineType("TempClass",TypeAttributes.Public);
FieldBuilder myGreetingField = myTypeBuilder.DefineField("Greeting",
typeof(String), FieldAttributes.Public);
Type[] myConstructorArgs = { typeof(String) };
// 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);
[C++]
MethodBuilder* myMethodBuilder = 0;
AppDomain* myCurrentDomain = AppDomain::CurrentDomain;
// Create assembly in current CurrentDomain.
AssemblyName* myAssemblyName = new AssemblyName();
myAssemblyName->Name = S"TempAssembly";
// Create a dynamic assembly.
myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly
(myAssemblyName, AssemblyBuilderAccess::Run);
// Create a dynamic module in the assembly.
myModuleBuilder = myAssemblyBuilder->DefineDynamicModule(S"TempModule");
// Create a type in the module.
TypeBuilder* myTypeBuilder = myModuleBuilder->DefineType(S"TempClass",TypeAttributes::Public);
FieldBuilder* myGreetingField = myTypeBuilder->DefineField(S"Greeting",
__typeof(String), FieldAttributes::Public);
Type* myConstructorArgs[] = { __typeof(String) };
// 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(S"Module Name : {0}", myModule->Name);
// Get the 'MethodToken' that represents the token for this constructor.
MethodToken myMethodToken = myConstructorBuilder->GetToken();
Console::WriteLine(S"Constructor Token is : {0}", __box(myMethodToken.Token));
// Get the method implementation flags for this constructor.
MethodImplAttributes myMethodImplAttributes = myConstructorBuilder->GetMethodImplementationFlags();
Console::WriteLine(S"MethodImplAttributes : {0}", __box(myMethodImplAttributes));
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
ConstructorBuilder クラス | ConstructorBuilder メンバ | System.Reflection.Emit 名前空間