【发布时间】:2016-06-15 07:20:19
【问题描述】:
我如何使用反射来调用这个方法。
using System.Reflection
public static string NotSoObvius<V>(V show) where V : class
{
return string.Format("This is it", show);
}
【问题讨论】:
-
我们看不到该方法所属的类或结构。但除此之外,
var res = (string)typeof(Xxx).GetMethod("NotSoObvius").MakeGenericMethod(show.GetType()).Invoke(null, new[] { show, })之类的东西应该没问题。 -
注意到谢谢,但我有点不懂
标签: c#