I m reading some MethodInfo
from a proxy generated from a wsdl.
其中一种方法有三种(int
)参数和int
返回类型,但在我探讨ParailesInfo[]
I时,实际看见8个参数:
Int32
,Boolean
,Int32
,Boolean
,Int32
,Boolean
,Int32&
,Boolean&
这些额外参数源自何处?
附录
更细致的是,所生成的代用法中的代码如下:
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/IInleerAppService/AddThreeNumbers", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void AddThreeNumbers(int one, [System.Xml.Serialization.XmlIgnoreAttribute()] bool oneSpecified, int two, [System.Xml.Serialization.XmlIgnoreAttribute()] bool twoSpecified, int three, [System.Xml.Serialization.XmlIgnoreAttribute()] bool threeSpecified, out int AddThreeNumbersResult, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool AddThreeNumbersResultSpecified) {
object[] results = this.Invoke("AddThreeNumbers", new object[] {
one,
oneSpecified,
two,
twoSpecified,
three,
threeSpecified});
AddThreeNumbersResult = ((int)(results[0]));
AddThreeNumbersResultSpecified = ((bool)(results[1]));
}
为什么如此?
附录
如果你像我这样重新 by,那么你可以简单地适用以下法典,很容易避免显示这些额外参数:
if (!parameterInfo[i].Name.EndsWith("Specified") && !parameterInfo[i].IsRetval && !parameterInfo[i].Name.EndsWith("Result"))
{
// magic
}