there is a way to create and invoke a function in run time? for instance, how could I do to invoke this function?
string function = @"public void Test(int num1, int num2)
{
int sum = num1 + num2;
MessageBox.Show(sum.ToString());
}";
System.Reflection.MethodInfo method = null; // some code to create a method info from the string function
method.Invoke(this, new object[] { 10, 20 });
All I could find were samples of System.Reflection.Emit.DynamicMethod, but none use a function in a string
Aucun commentaire:
Enregistrer un commentaire