zoukankan      html  css  js  c++  java
  • WebService中的out参数

    这个问题来自论坛,在.net 2.0中一个WebMethod的out参数丢失了....

    不过应该是写代码的人太粗心,没有仔细看web引用的结构。微软只是在web引用的时候做了一个转换,把void类型函数的out参数自动转换为非void函数,并把这个参数变成了函数的返回值。

    比如:

    [WebMethod]
    
        public void getPwdNick(int userid,out string pwd,out string nick)
    
        {
    
        }

    他会在web引用后生成如下代码:

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/getPwdNick", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]         [return: System.Xml.Serialization.XmlElementAttribute("pwd")]         public string getPwdNick(int userid,out string nick) {             object[] results = this.Invoke("getPwdNick", new object[] {                        userid});             nick = ((string)(results[1]));             return ((string)(results[0]));                    } 这段代码在vs中点击显示所有文件,然后再web refences下面localhost-Reference.map-Reference.cs中。

  • 相关阅读:
    StringUtils 之 hasLength()
    XML命名空间详解
    Spring bean属性 abstract、parent
    Springboot thymeleaf <thymeleaf‐layout‐dialect.version>2.2.2</thymeleaf‐layout‐dialect.version>标签导入报错
    Springboot 处理静态资源
    git命令
    nftables--linux
    debian handbook手册
    tcp和ip header
    linux内核参数-rp_filter
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204915.html
Copyright © 2011-2022 走看看