Hello Evain,

Sorry i got one simple question about one thing i have notice , from
the above assembly , by using this code

private void button2_Click(object sender, EventArgs e)
        {
            var asm = AssemblyDefinition.ReadAssembly("test.exe");

            TypeDefinition type =
asm.MainModule.GetType("test.Form1");
            asm.MainModule.Types.Remove(type);
            asm.Write("ccc.exe");

        }


I can delete type test.Form2, test.Program etc but why i cannot delete
Form1 , there is exception thrown nullreference when
asm.Write("ccc.exe"); , basically program is when button press form2
show. Similarly if there is

test
   Form1
   Form2
   Form3
   Form4    I cannot delete Form1/form2/form3  and only form4 i can
delete, Any idea?

Many thanks






On Jun 18, 4:54 pm, Jb Evain <[email protected]> wrote:
> On Fri, Jun 18, 2010 at 5:45 PM, david khan <[email protected]> wrote:
> > Please advise anyway i could use string like
> > before, as i have about 100 methods to delete.
>
> You would have read the migration guide you would know. Use
> ModuleDefinition.GetType(string).
>
> --
> Jb Evain  <[email protected]>

-- 
--
mono-cecil

Reply via email to