Ok, finall done with this style coding
public static class Class1
{
public static void RemoveMethod(this TypeDefinition self,
string methodName)
{
var method = self.Methods.FirstOrDefault(m => m.Name ==
methodName);
if (method == null)
return;
self.Methods.Remove(method);
}
}
private void button1_Click(object sender, EventArgs e)
{
var asm =AssemblyDefinition.ReadAssembly("test.exe");
TypeDefinition type = asm.MainModule.Types[1];
Class1.RemoveMethod(type, "aa");
asm.Write(".exe");
}
But the problem i got is "asm.MainModule.Types[1];" , before cecil
library i could use "asm.MainModule.Types["Form1"]; , i mean i could
use string "Form1" , but now i have to find out first which one is
Types [1] or [0] or [2]. Please advise anyway i could use string like
before, as i have about 100 methods to delete.
Many thanks
On Jun 18, 4:23 pm, Jb Evain <[email protected]> wrote:
> On Fri, Jun 18, 2010 at 4:55 PM, david khan <[email protected]> wrote:
> > Any solution for that?
>
> http://wiki.github.com/jbevain/cecil/migration
>
> --
> Jb Evain <[email protected]>
--
--
mono-cecil