ModuleBuilder

ModuleBuilder

System.Reflection.Emit (mscorlib.dll) class

This class represents a dynamically created module inside a dynamic assembly. Dynamic modules are created with the AssemblyBuilder.DefineDynamicModule( ) method. A dynamic module can be either transient or persistable, which means you can save it to disk as part of a PE file. To create a persistable module, use a version of the AssemblyBuilder.DefineDynamicModule( ) method that allows you to specify a filename.

You can use the methods that begin with Define to create types, managed and unmanaged resources, global methods, and PInvoke (global native) methods.

 public class  ModuleBuilder  : System.Reflection.Module {  // Public Instance Properties  public override string  FullyQualifiedName  {get; }  // overrides System.Reflection.Module   // Public Instance Methods  public void  CreateGlobalFunctions  ( );    public ISymbolDocumentWriter  DefineDocument  (string   url   , Guid   language   , Guid   languageVendor   ,        Guid   documentType   );    public EnumBuilder  DefineEnum  (string   name   , System.Reflection.TypeAttributes   visibility   ,          Type   underlyingType   );    public MethodBuilder  DefineGlobalMethod  (string   name   , System.Reflection.MethodAttributes   attributes   ,        System.Reflection.CallingConventions   callingConvention   ,Type   returnType   , Type[ ]   parameterTypes   );    public MethodBuilder  DefineGlobalMethod  (string   name   , System.Reflection.MethodAttributes   attributes   ,        Type   returnType   , Type[ ]   parameterTypes   );    public FieldBuilder  DefineInitializedData  (string   name   , byte[ ]   data   ,          System.Reflection.FieldAttributes   attributes   );    public MethodBuilder  DefinePInvokeMethod  (string   name   , string   dllName   ,        System.Reflection.MethodAttributes   attributes   ,         System.Reflection.CallingConventions   callingConvention   ,        Type   returnType   ,        Type[ ]   parameterTypes   , System.Runtime.InteropServices.CallingConvention   nativeCallConv   ,         System.Runtime.InteropServices.CharSet   nativeCharSet   );    public MethodBuilder  DefinePInvokeMethod  (string   name   , string   dllName   , string   entryName   ,        System.Reflection.MethodAttributes   attributes   ,         System.Reflection.CallingConventions   callingConvention   ,        Type   returnType   , Type[ ]   parameterTypes   , System.Runtime.InteropServices.CallingConvention   nativeCallConv   ,        System.Runtime.InteropServices.CharSet   nativeCharSet   );    public IResourceWriter  DefineResource  (string   name   , string   description   );    public IResourceWriter  DefineResource  (string   name   , string   description   ,          System.Reflection.ResourceAttributes   attribute   );    public TypeBuilder  DefineType  (string   name   );    public TypeBuilder  DefineType  (string   name   , System.Reflection.TypeAttributes   attr   );    public TypeBuilder  DefineType  (string   name   , System.Reflection.TypeAttributes   attr   , Type   parent   );    public TypeBuilder  DefineType  (string   name   , System.Reflection.TypeAttributes   attr   , Type   parent   ,          int   typesize   );    public TypeBuilder  DefineType  (string   name   , System.Reflection.TypeAttributes   attr   , Type   parent   ,          PackingSize   packsize   );    public TypeBuilder  DefineType  (string   name   , System.Reflection.TypeAttributes   attr   , Type   parent   ,        PackingSize   packingSize   , int   typesize   );    public TypeBuilder  DefineType  (string   name   , System.Reflection.TypeAttributes   attr   , Type   parent   ,          Type[ ]   interfaces   );    public FieldBuilder  DefineUninitializedData  (string   name   , int   size   , System.Reflection.FieldAttributes   attributes   );    public void  DefineUnmanagedResource  (byte[ ]   resource   );    public void  DefineUnmanagedResource  (string   resourceFileName   );    public MethodInfo  GetArrayMethod  (Type   arrayClass   , string   methodName   ,        System.Reflection.CallingConventions   callingConvention   , Type   returnType   , Type[ ]   parameterTypes   );    public MethodToken  GetArrayMethodToken  (Type   arrayClass   , string   methodName   ,         System.Reflection.CallingConventions   callingConvention   ,Type   returnType   , Type[ ]   parameterTypes   );    public MethodToken  GetConstructorToken  (System.Reflection.ConstructorInfo   con   );    public FieldToken  GetFieldToken  (System.Reflection.FieldInfo   field   );    public MethodToken  GetMethodToken  (System.Reflection.MethodInfo   method   );    public SignatureToken  GetSignatureToken  (byte[ ]   sigBytes   , int   sigLength   );    public SignatureToken  GetSignatureToken  (SignatureHelper   sigHelper   );    public StringToken  GetStringConstant  (string   str   );    public ISymbolWriter  GetSymWriter  ( );    public override Type  GetType  (string   className   );  // overrides System.Reflection.Module  public override Type  GetType  (string   className   , bool ignoreCase);  // overrides System.Reflection.Module  public override Type  GetType  (string   className   , bool throwOnError, bool ignoreCase)  // overrides System.Reflection.Module  public override Type[ ]  GetTypes  ( );  // overrides System.Reflection.Module  public TypeToken  GetTypeToken  (string   name   );    public TypeToken  GetTypeToken  (Type   type   );    public bool  IsTransient  ( );    public void  SetCustomAttribute  (System.Reflection.ConstructorInfo   con   ,          byte[ ]   binaryAttribute   );    public void  SetCustomAttribute  (CustomAttributeBuilder   customBuilder   );    public void  SetSymCustomAttribute  (string   name   , byte[ ]   data   );    public void  SetUserEntryPoint  (System.Reflection.MethodInfo   entryPoint   ); } 

Hierarchy

System.Object System.Reflection.Module(System.Runtime.Serialization.ISerializable , System.Reflection.ICustomAttributeProvider) ModuleBuilder

Returned By

AssemblyBuilder.{DefineDynamicModule( ) , GetDynamicModule( )}



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net