public string GetMethod(string methodName, BookingRequest bookingId)
{
EmailTemplate p1 = new EmailTemplate();//类
Type t = p1.GetType();
var mi = t.GetMethod(methodName, new Type[] { typeof(BookingRequest) }); //得到对应的方法
//通过反射执行ReturnAutoID方法,返回AutoID值
object body= mi.Invoke(p1, new object[] { bookingId });//方法和参数
return body<span style="font-family: Arial, Helvetica, sans-serif;">.ToString();</span>
}
C#根据字符串名称 得到对应的方法
最新推荐文章于 2024-04-26 06:02:49 发布