using System;
using System.Reflection;
class Starter {
static void Main() {
MyClass obj = new MyClass();
Type tObj = obj.GetType();
MethodInfo method = tObj.GetMethod("MethodA");
method.Invoke(obj, null);
tObj.InvokeMember("MethodA", BindingFlags.InvokeMethod,
null, obj, null);
}
}
class MyClass {
public void MethodA() {
Console.WriteLine("MyClass.Method invoked");
}
}
|