Cita:
Iniciado por xknown
Estimado, lee la documentación -por eso dejé el filtro de búsqueda.
Ya me la había leído, pero tengo dudas sobre su utilización y preguntaba por si me poníais un ejemplo real.
Para enviarme al google o MSDN no necesito tu ayuda.
Por si alguien está en la misma situación que yo, pego aquí el código que estoy utilizando.
public void Test()
{
MyClass myClass = new MyClass();
MyInterface myInterface = (MyInterface)myClass;
MyDoSomethingArgs myArgs = new MyDoSomethingArgs();
TestMethod(myClass, "DoSomething", myArgs);
TestMethod(myInterface, "DoSomething", myArgs);
}
public void TestMethod(object target, string method, params object[] args)
{
// Do a ton of setup
target.GetType().InvokeMember(method,
System.Reflection.BindingFlags.InvokeMethod, null,
target, args);
// Analyze the results and tear it all down
}
Saludos y gracias,
Guitar