namespace TestReflection
{
public class MyCls
{
public void Fun()
{
Console.WriteLine("MyCls.Fun invoke.");
}
}
}
/////////////////////////////////////////////////////////
...
using System.Reflection;
class Program
static void Main(string[] args)
Type type = Assembly.Load("TestReflection").GetType("TestReflection.MyCls");
object obj= Activator.CreateInstance(type);
type.InvokeMember("Fun", BindingFlags.Default | BindingFlags.InvokeMethod,
null, obj, new object[] { });
Console.ReadKey();