using System;
namespace DefaultNamespace
{
public class A
{
public void greet()
{
Console.WriteLine("greeting from A");
}
}
public class B
{
public void greet()
{
Console.WriteLine("greeting from B");
}
}
class Program
{
static void Main(string[] args)
{
string className = "DefaultNamespace.A";
string functionName = "greet";
Type t = Type.GetType(className);
System.Reflection.MethodInfo method = t.GetMethod(functionName);
Object o = System.Activator.CreateInstance(t);
method.Invoke(o,null);
}
}
}
08-25
11-01
1413
