使用方法名的字符串,调用该类中的方法。
/// <summary>
/// 绘制线性波形
/// </summary>
public void DrawLinear()
{
//实现方法
}
private void button_click(object sender,EventArgs e)
{
this.GetType().GetMethod("DrawLinear").Invoke(this, null);
}
请注意被调用的方法一定要是公用的。
使用方法名的字符串,调用该类中的方法。
/// <summary>
/// 绘制线性波形
/// </summary>
public void DrawLinear()
{
//实现方法
}
private void button_click(object sender,EventArgs e)
{
this.GetType().GetMethod("DrawLinear").Invoke(this, null);
}
请注意被调用的方法一定要是公用的。
转载于:https://www.cnblogs.com/rogation/archive/2012/11/05/2755481.html