سؤال

I am trying to access my list in a webservice but i receive an error

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\

my class is named auditclass

auditclass.MyObjectVariableList.Add(DBNull.Value); 

this is in my webservice

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

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

take note. i am using VS 2005 .net2.0

هل كانت مفيدة؟

المحلول

you have List on server side but when you add reference to that service you get array of items. you can change this behavior while you adding service. check below SO post

Webservice(asmx) returns array, not list

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top