MethodBuilder.SetImplementationFlags メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Public Sub SetImplementationFlags ( _ attributes As MethodImplAttributes _ )
Dim instance As MethodBuilder Dim attributes As MethodImplAttributes instance.SetImplementationFlags(attributes)
public void SetImplementationFlags ( MethodImplAttributes attributes )
public: void SetImplementationFlags ( MethodImplAttributes attributes )
public void SetImplementationFlags ( MethodImplAttributes attributes )
public function SetImplementationFlags ( attributes : MethodImplAttributes )


SetImplementationFlags メソッドを SetCustomAttribute メソッドと組み合わせて使用する場合には、対話が発生する可能性があることに注意してください。たとえば、SetCustomAttribute メソッドを使用して DllImportAttribute 属性を追加すると、MethodImplAttributes.PreserveSig フラグも設定されます。この後に SetImplementationFlags メソッドを呼び出すと、PreserveSig フラグが上書きされます。これを回避するには、次の 2 とおりの方法があります。

SetImplementationFlags メソッドを使用して、メソッド本体の MSIL の実装について指定する方法については、次のコード例を参照してください。
Dim myMthdBuilder As MethodBuilder = myTypeBuilder.DefineMethod("MyMethod", _ MethodAttributes.Public, _ CallingConventions.HasThis, _ GetType(Integer), _ New Type() {GetType(Integer), GetType(Integer)}) ' Specifies that the dynamic method declared above has a an MSIL implementation , ' is managed, synchronized (single-threaded) through the body, and that it ' cannot be inlined. myMthdBuilder.SetImplementationFlags((MethodImplAttributes.IL Or _ MethodImplAttributes.Managed Or _ MethodImplAttributes.Synchronized Or _ MethodImplAttributes.NoInlining)) ' Create an ILGenerator for the MethodBuilder and emit MSIL here ...
MethodBuilder myMthdBuilder = myTypeBuilder.DefineMethod("MyMethod", MethodAttributes.Public, CallingConventions.HasThis, typeof(int), new Type[] { typeof(int) , typeof(int) }); // Specifies that the dynamic method declared above has a an MSIL implementation , // is managed, synchronized (single-threaded) through the body, and that it // cannot be inlined. myMthdBuilder.SetImplementationFlags(MethodImplAttributes.IL | MethodImplAttributes.Managed | MethodImplAttributes.Synchronized | MethodImplAttributes.NoInlining); // Create an ILGenerator for the MethodBuilder and emit MSIL here ...
array<Type^>^ temp0 = { int::typeid, int::typeid }; MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod" , MethodAttributes::Public, CallingConventions::HasThis, int::typeid, temp0 ); // Specifies that the dynamic method declared above has a an MSIL implementation , // is managed, synchronized (single-threaded) through the body, and that it // cannot be inlined. myMthdBuilder->SetImplementationFlags( (MethodImplAttributes)( MethodImplAttributes::IL | MethodImplAttributes::Managed | MethodImplAttributes::Synchronized | MethodImplAttributes::NoInlining) ); // Create an ILGenerator for the MethodBuilder and emit MSIL here ...
MethodBuilder myMthdBuilder = myTypeBuilder.DefineMethod( "MyMethod", MethodAttributes.Public, CallingConventions.HasThis, int.class.ToType(), new Type[] { int.class.ToType(), int.class.ToType()}); // Specifies that the dynamic method declared above has a an MSIL // implementation, is managed, synchronized (single-threaded) through // the body, and that it cannot be inlined. myMthdBuilder.SetImplementationFlags((MethodImplAttributes.IL | MethodImplAttributes.Managed | MethodImplAttributes.Synchronized | MethodImplAttributes.NoInlining)); // Create an ILGenerator for the MethodBuilder and emit MSIL here ...

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMethodBuilder.SetImplementationFlags メソッドを検索する場合は、下記のリンクをクリックしてください。

- MethodBuilder.SetImplementationFlags メソッドのページへのリンク