c# - Xml children not deserializing -
public class menunavigationitem { public int code { get; set; } public string name { get; set; } public int parent { get; set; } public int no { get; set; } public int parentcode { get; set; } public string level { get; set; } public string pagename { get; set; } public string objectname { get; set; } [xmlarray(elementname = "menunavigationitem")] public list<menunavigationitem> children { get; set; } }
<menunavigationitem code="4" name="products"> <parent>0</parent> <no>4</no> <parentcode>0</parentcode> <code>4</code> <level>1</level> <name>products</name> <!-- product harvestmax--> <menunavigationitem code="41" name="harvestmax"> <parent>4</parent> <no>41</no> <parentcode>4</parentcode> <code>41</code> <level>2</level> <name>harvestmax</name> <menunavigationitem code="411" name="quote"> <parent>41</parent> <no>411</no> <parentcode>41</parentcode> <code>411</code> <level>3</level> <name>quote</name> <pagename>gbcopersonallines\gbcopersonallinesproducts\gbcohobrowse.aspx?objecttype=q</pagename> <objectname>gbcoho</objectname> <hotkey>q</hotkey> </menunavigationitem> </menunavigationitem>
what children of products, it's not putting harvestmax it's putting harvestmax's children. how strange.
what causing , how fix it?
solved
i needed use xmlelement
, not xmlarray
attribute. worked perfectly.
Comments
Post a Comment