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> }