c# - ...may not be used in this context...while serialization -


i've webservice , webmethod

[webmethod] [xmlinclude(typeof(contractcar[])) public object getobjects(cars[] cars) { return translator.toobjects(facade.getobjects(cars);  }  public static object getobjects(cars cars) { list<car>  cars =new list<country(...fillingcollection) return cars.toarray(), }  public static object toobjects(object collection) { if(collection car[]) { return convertmodelcarstocontractcars(collection), }  public contractcar[]  convertmodelcarstocontractcars(cars[] collection) { ...there rewriting pool... } 

and exception @ side of client:

there error generating xml document.

i'm using function check collection send client , works.

 public static void serializecontainer(object obj)         {             try             {                 // make sure construsctor runs inside                 // try-catch block                 xmlserializer ser = new xmlserializer(typeof(object));                  textwriter w = new streamwriter(@"c:\list.xml");                 ser.serialize(w, obj);                 w.close();              }             catch (exception ex)             {                 dumpexception(ex);             }         } 

interesting when collection has 1 element [webmethod] works fine, when more brokes

i changed object objects[].


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -