Hello!
I have some assembly ("mylib.dll"), and my task is to build program
where i can choose from comboboxes class name and method name and
invoke this method with some default parameters and print result. If i
understood right, Cecil is exactly what i need.
I have no problems with getting class and method names, but i can't
(due to no documentation) understand, how can i invoke methods?
Here's my code:
private static void InvokeMethod(object obj,EventArgs e)
{
string str_type = classCombo.ActiveText;
string str_method = methodsCombo.ActiveText;
if (str_type != "" && str_method != "")
{
MethodDefinition method =
GetMetDef(str_type,str_method);
MethodReference refer =
method.GetOriginalMethod();
// HERE i need somehow to call method, for example without any
paramaters
}
}
GetMetDef - is a function, which returns MethodDefinition from my
assembly by class name and method name. I tried to create CilWorker,
but nothing happend. I think i don't understand how it should work.
--
--
mono-cecil