111,098
社区成员




private bool refTest(string a, ref string b, ref string[] c)
{
b = b+a;
c[0] = c[0] + a;
return true;
}
private delegate bool refInvokeHand(string p0, ref string p1, ref string[] p2);
static refInvokeHand GetRefInvoke()
{
Type[] methodArgs = { typeof(string), typeof(string).MakeByRefType(), typeof(string[]).MakeByRefType() };
DynamicMethod reftest2 = new DynamicMethod("reftest2", typeof(bool), methodArgs, typeof(Form1).Module);
ILGenerator il = reftest2.GetILGenerator();
il.Emit(OpCodes.Nop);
...
...
...
return (refInvokeHand)reftest2.CreateDelegate(typeof(refInvokeHand));
}
private bool refTest2(string a, ref string b, ref string[] c)
{
refInvokeHand myHand=GetRefInvoke();
return myHand(a,ref b,ref c);
}
private bool refTest(string a, ref string b, ref string[] c)
{
b = b+a;
c[0] = c[0] + a;
return true;
}