从服务方法的参数给出某个ParameterInfo,我想检查这个参数是否是输出类型。是否足以检查其ParameterType
最后是否包含&
个符号?我注意到System.String
这样的对象在输出类型时变为System.String&
,或者,有没有更好的方法来检查它?
答案 0 :(得分:1)
ParameterInfo p = ...;
bool isOutParam =(p.Attributes& System.Reflection.ParameterAttributes.Out)== System.Reflection.ParameterAttributes.Out;