Hello,

  Sorry i don't know exactly where to post and sending to your mail.
I have an assembly "test.exe" and structure is like that , there are
some treeview example like reflexil , netdasm , but i already know
which type and method i have to delete and i got list of methods and
types to delete .

test.exe
     Form1
         Dispose
         InitializeComponent
         aa
         dd
         button1_Click
    Form2
         Dispose
         InitializeComponent
         aa
         xx
         button1_Click
   Resources
         Settings
         get_Default
   Program
         Main


     I am trying to delete Types and methods, to delete types i use
like that

            TypeDefinition type =
assembly.MainModule.Types["test.Form1"];
            assembly.MainModule.Types.Remove(type);

and it is ok ,but how do i delete method "test.Form1.aa"  , i use this
way but no success



    foreach (TypeDefinition type in assembly.MainModule.Types)
            {
                if (type.Name == "Form1")
                {

                    foreach (MethodDefinition method in type.Methods)
                    {
                        if (method.Name == "bb")
                        {
                           type.Methods.Remove(method);

                        }
                    }

                }
            }


So can anybody advice how to delete methods and is there simple way to
delete like if i want to delete method "aa" of type "Form1" , just
give url of assembly like that
          type.Methods.Remove("test.Form1.aa");



Many thanks

-- 
--
mono-cecil

Reply via email to