private static void UpdateComTypesInAssembly(AssemblyBuilder asmBldr, ModuleBuilder modBldr)
 {
     AssemblyBuilderData assemblyData = asmBldr.m_assemblyData;
     Type[] types = modBldr.GetTypes();
     int length = types.Length;
     for (int i = 0; i < length; i++)
     {
         assemblyData.AddPublicComType(types[i]);
     }
 }
        private static void UpdateComTypesInAssembly(AssemblyBuilder asmBldr, ModuleBuilder modBldr)
        {
            // Retrieve the AssemblyBuilderData associated with the assembly builder.
            AssemblyBuilderData AsmBldrData = asmBldr.m_assemblyData;

            // Go through the types in the module and add them as public COM types.
            Type[] aTypes = modBldr.GetTypes();
            int NumTypes = aTypes.Length;
            for (int cTypes = 0; cTypes < NumTypes; cTypes++)
                AsmBldrData.AddPublicComType(aTypes[cTypes]);
        }
Esempio n. 3
0
 // ...
 // There's a bug in ModuleBuilder.GetType(), so we have to use our own 
 // version for now.
 System.Type ModuleBuilder_GetType(ModuleBuilder m, string stType)
 {
 #if false
     // This should work, but is broken for nested types.
     return m.GetType(stType);
 #else        
     // Here's our hack to use in the meantime
     // Note, we have to deal with appended characters like [], and &
     // This is a hack that will work for now. When reflection-emit fixes the 
     // bug, we can get rid of this.
     Type [] al = m.GetTypes();
     foreach(Type t in al)
     {
         if (t.FullName == stType)
             return t;
     }
     return null;    
 #endif
 }