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中。

  • 相关阅读:
    JQuery Mobile
    JQuery
    JQuery Mobile
    JQuery Mobile
    JQuery Mobile
    5G && 物联网
    Sass(Syntactically Awesome Stylesheets)——概述(待续)
    Sass(Syntactically Awesome Stylesheets)——使用React JS实现
    Yarn概述——FAST, RELIABLE, AND SECURE DEPENDENCY MANAGEMENT
    webpack——Modules && Hot Module Replacement
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204915.html
Copyright © 2011-2022 走看看