MethodBase.GetMethodImplementationFlags Method
.NET Framework 4
When overridden in a derived class, returns the MethodImplAttributes flags.
Assembly: mscorlib (in mscorlib.dll)
The following example defines a constructor in a dynamic assembly and then uses the GetMethodImplementationFlags method to display the method implementation flags that are set by default.
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);
-
ReflectionPermission
when invoked late-bound through mechanisms such as Type.InvokeMember. Associated enumeration: ReflectionPermissionFlag.MemberAccess.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.