Hi all, i need to call a void method with reflection that have 2 normal params and a third param that is a reference param. I've seen many posts about the problem and all suggest to use the GetMethod function instead of InvokeMember. I've tried the InvokeMember and it works, someone can explain me why?
Class1 myreferenceparam = new Class1();
myobject.InvokeMember("MyMethod", BindingFlags.InvokeMethod | BindingFlags.Default, null, myobject, new object[] { myparam1, myparam2, myreferenceparam });
Response.Write(myreferenceparam.myfield);
The method MyMethod edit the field myfield of the Class1. Is my code correct or should i anyway use GetMethod?