[英]How do I check if a service method's parameter type is an output type given the parameter's ParameterInfo?
Given a certain ParameterInfo from the parameter of a service method, I would like to check if this parameter is an output type. 给定服务方法的参数中的ParameterInfo ,我想检查此参数是否为输出类型。 Would it be enough to check if its
ParameterType
contains an &
sign at the end? 检查其
ParameterType
是否在结尾处包含&
符号是否足够? I've noticed objects like System.String
become System.String&
when they are output types, or, is there a better way to check for this? 我注意到像
System.String
这样的对象在成为输出类型时会变成System.String&
,或者,有没有更好的方法来检查这一点?
ParameterInfo p = ...; ParameterInfo p = ...;
bool isOutParam = (p.Attributes & System.Reflection.ParameterAttributes.Out) == System.Reflection.ParameterAttributes.Out; bool isOutParam =(p.Attributes&System.Reflection.ParameterAttributes.Out)== System.Reflection.ParameterAttributes.Out;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.