【问题标题】:Accessing List in webservice在 web 服务中访问列表
【发布时间】:2013-12-19 12:55:18
【问题描述】:

我正在尝试在网络服务中访问我的列表,但收到错误消息

Error   7   'System.Array' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?) C:\Users\kacobilla\Desktop\Rics@12.4.13\Clearance System\OCMS_AuditTrailPage.aspx.cs    87  53  C:\...\Clearance System\

我的班级名为auditclass

auditclass.MyObjectVariableList.Add(DBNull.Value); 

这是在我的网络服务中

 private List<object> _myObjectVariableList = new List<object>();

    public List<object> MyObjectVariableList
    {
        get { return _myObjectVariableList; }
        set { _myObjectVariableList = value; }
    }

注意。我正在使用 VS 2005 .net2.0

【问题讨论】:

    标签: c# asp.net web-services .net-2.0 asmx


    【解决方案1】:

    您在服务器端有 List,但是当您添加对该服务的引用时,您会得到一系列项目。您可以在添加服务时更改此行为。检查下面的SO帖子

    Webservice(asmx) returns array, not list

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多