private static void ReadType(TypeDefinition type)
 {
     ImmediateModuleReader.ReadGenericParameters(type);
     if (type.HasInterfaces)
     {
         ImmediateModuleReader.Read(type.Interfaces);
     }
     if (type.HasNestedTypes)
     {
         ImmediateModuleReader.ReadTypes(type.NestedTypes);
     }
     if (type.HasLayoutInfo)
     {
         ImmediateModuleReader.Read(type.ClassSize);
     }
     if (type.HasFields)
     {
         ImmediateModuleReader.ReadFields(type);
     }
     if (type.HasMethods)
     {
         ImmediateModuleReader.ReadMethods(type);
     }
     if (type.HasProperties)
     {
         ImmediateModuleReader.ReadProperties(type);
     }
     if (type.HasEvents)
     {
         ImmediateModuleReader.ReadEvents(type);
     }
     ImmediateModuleReader.ReadSecurityDeclarations(type);
     ImmediateModuleReader.ReadCustomAttributes(type);
 }
        public static void ReadModule(ModuleDefinition module)
        {
            if (module.HasAssemblyReferences)
            {
                ImmediateModuleReader.Read(module.AssemblyReferences);
            }
            if (module.HasResources)
            {
                ImmediateModuleReader.Read(module.Resources);
            }
            if (module.HasModuleReferences)
            {
                ImmediateModuleReader.Read(module.ModuleReferences);
            }
            if (module.HasTypes)
            {
                ImmediateModuleReader.ReadTypes(module.Types);
            }
            if (module.HasExportedTypes)
            {
                ImmediateModuleReader.Read(module.ExportedTypes);
            }
            if (module.HasCustomAttributes)
            {
                ImmediateModuleReader.Read(module.CustomAttributes);
            }
            AssemblyDefinition assembly = module.Assembly;

            if (assembly == null)
            {
                return;
            }
            if (assembly.HasCustomAttributes)
            {
                ImmediateModuleReader.ReadCustomAttributes(assembly);
            }
            if (assembly.HasSecurityDeclarations)
            {
                ImmediateModuleReader.Read(assembly.SecurityDeclarations);
            }
        }