sma*_*man 2 .net c# reflection system.reflection parameterinfo
如何确定a ParameterInfo是否为返回参数?
我写了下面的函数,但我担心我可能会遗漏一些东西:
public bool IsReturnParameter(ParameterInfo parameter){
var method = parameter.Member as MethodInfo;
return method != null && parameter.Equals(method.ReturnParameter);
}
Run Code Online (Sandbox Code Playgroud)
(1)参数都宣布对成员是:我的一对夫妇的假设,这可能是有缺陷的这个基础MethodInfo,ConstructorInfo或PropertyInfo(索引).(2)ConstructorInfo并且PropertyInfo永远不会有返回参数.