草庐IT

GenericExtension

全部标签

c# - 如何使用反射调用通用扩展方法?

我写了扩展方法GenericExtension。现在我想调用扩展方法Extension。但是methodInfo的值始终为null。publicstaticclassMyClass{publicstaticvoidGenericExtension(thisForma,stringb)whereT:Form{//code...}publicstaticvoidExtension(thisForma,stringb,Typec){MethodInfomethodInfo=typeof(Form).GetMethod("GenericExtension",new[]{typeof(strin