Hi guys,
I've something like the following code inside a type:
publoc void m()
{
new Text().DoSomething();
}
In IL its:
nop
newobj System.Void B.Text::ctor()
stloc.0
ldloc.0
callvirt System.Void C:Tbase::DoSomething() //Because Text
inherits from Tbase
nop
And I want to replace this instruction in order to have the following
(TBaseFactory is property already defined):
public void m()
{
TBaseFactory().DoSomething();
}
nop
call System.Func'1<C.Tbase> A.Ta::get_TBaseFactory()
callvirt !0 System.Func'1<C.Tbase>::Invoke()
stloc.0
ldloc.0
callvirt System.Void C.Tbase::DoSomething()
nop
ret
My problem is that I dont know how to create the highlighted instruction.
Specifically I don't know where can I get the MethodReference for Invoke()
of Func'1<C.Tbase>.
Regards.
--
Jair Cazarin Villanueva
http://jaircazarin.blogspot.com
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---