c# - How to define list structure so XmlSerializer understands it -


i'm working on deserializing xml web service. here how object looks:

[serializable] public class docketdata {      [xmlelement(elementname = "policylist")]     public list<policyitem> policylist { get; set; } } 

here policyitem:

[serializable]     public class policyitem     {         [xmlelement(elementname = "companyname")]         public string companyname { get; set; }          [xmlelement(elementname = "attntoname")]         public string attntoname { get; set; }          [xmlelement(elementname = "address")]         public string address { get; set; }          [xmlelement(elementname = "city")]         public string city { get; set; } 

here xml:

<docketdata>        <policylist>         <policyitem>           <companyname>crum &mpany</companyname>           <attntoname>to report00</attntoname>           <address>305 ave.</address> 

when deserialize using xml serializer seems 1 item of policyitem won't deserialize it's properties

enter image description here

just change

[xmlelement(elementname = "policylist")] 

to

[xmlarray(elementname = "policylist")] 

btw: don't need [serializable] attributes


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -