Type.GetMethods解决方案

Type.GetMethods反射获取指定参数的方法如何取得:得指定参数的方法比如:getMethods可以取得voidTest1(inti

Type.GetMethods
反射获取指定参数的方法
如何取得:得指定参数的方法
比如:getMethods可以取得   void   Test1(int   i)   和void   test2(int   i,   int   j);

我如何得到   test2,也就是,我只要参数是两个int   的方法?


[解决办法]
返回的是MethodInfo数组。数组中方法的排列顺序是按字母顺序。试试GetMethod( "test2 ")。
[解决办法]
typeof(...).GetMethod( "test2 ");
[解决办法]
使用这个重载方法:
MethodInfo GetMethod (
string name,
Type[] types
)
第2个参数就是你要调用方法的参数类型数组