日期:2014-05-19  浏览次数:20821 次

方法的名字可能赋给一个变量吗,实现方法的定义和使用分离
rt

------解决方案--------------------
建议你看看delegate,也就是C#的委托
------解决方案--------------------
using System;
using System.Collections.Generic;
using System.Text;

namespace testApplication1
{
public class RefTest
{
public void Test(string s)
{
Console.WriteLine(s);
}
}
}


MethodInfo info = typeof(RefTest).GetMethod( "Test ");
info.Invoke(new RefTest(), new object[] { "hello " });