G
Guest
How can I pass, by ref or out parameter values when calling DynamicInvoke
Method.
e.g. Here is my Delegate:
public delegate int BinaryOp(int x, int y, out double z, ref bool overflow);
Here is how I am creating a delegate object for "Subtract" method.
BinaryOp op2 = (BinaryOp) Delegate.CreateDelegate(dt, tt,"Subtract");
Here is how I am creating parameters object[]. Notice t and ret are
variables that I want to pass by ref and out. The following statement works
but ofcourse I am not passing them by ref or value here, so it's giving me
desired results:
object[] param = {3,4,t,ret};
Console.WriteLine(op2.DynamicInvoke(param));
I know I can use invoke method to get solve this issue but I want to see how
can I use DynamicInvoke. e.g. Using invoke it would be:
Console.WriteLine (op2(3,4, out t, ref ret));
Thanks in Advance
Arif
Method.
e.g. Here is my Delegate:
public delegate int BinaryOp(int x, int y, out double z, ref bool overflow);
Here is how I am creating a delegate object for "Subtract" method.
BinaryOp op2 = (BinaryOp) Delegate.CreateDelegate(dt, tt,"Subtract");
Here is how I am creating parameters object[]. Notice t and ret are
variables that I want to pass by ref and out. The following statement works
but ofcourse I am not passing them by ref or value here, so it's giving me
desired results:
object[] param = {3,4,t,ret};
Console.WriteLine(op2.DynamicInvoke(param));
I know I can use invoke method to get solve this issue but I want to see how
can I use DynamicInvoke. e.g. Using invoke it would be:
Console.WriteLine (op2(3,4, out t, ref ret));
Thanks in Advance
Arif