日期:2014-05-17 浏览次数:20870 次
public static class TestClass
{
public static void TestMethod<T>(){}
public static void TestMethod<T>(string name){}
public static void TestMethod<T, S>(){}
public static void TestMethod<T, S>(string name){}
}
ParameterInfo[] types;
MethodInfo method = typeof(LoginForm).GetMethods(BindingFlags.Static
------解决方案--------------------
BindingFlags.Public)
.First(t => t.Name == "TestMethod"
&& t.IsGenericMethod
&& t.GetGenericArguments().Length == 2
&& (types = t.GetParameters()).Length == 1 && types[0].ParameterType == typeof(string));