Hi,
I would like to ask how can I call (run) a function of an assembly
with Cecil?
For example, I have an assembly. In <Module>-Namespace of this
assembly there is a function with 2 args as Caculate(int arg1, int
arg2). This function is private. And I would like to call this one
from another assembly (seperate file) and receive the result of this
function.

With the namespace System.Reflection of Microsoft we can do like that

*********
Assembly a = Assembly.LoadWithPartialName("MyAssembly");
object obj = a.CreateInstance("MyType");
Type[] signature = new Type[] {typeof(int), typeof(string)};
MethodInfo method = obj.GetType().GetMethod("MyMethod",
signature);
object[] parameters = new object[] { 123, "abc" };
method.Invoke(obj, parameters);
**********

I don't know how can I do it with Cecil?
Thank you.
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to