c# - Serialization of List<T> to single XML Element with nested Elements -
i'm tying create xml file classes in following form:
what i'm getting:
<photographer name="meggan danzy" primary-camera="pentax k-500"> <lenses> <lensdto> <lens>pentax 2.8mm f77</lens> </lensdto> <lensdto> <lens>pentax 1.2mm f10</lens> </lensdto> <lensdto> <lens>pentax 2.8mm f135</lens> </lensdto> </lenses>
what want achieve
<photographer name="meggan danzy" primary-camera="pentax k-500"> <lenses> <lens>pentax 2.8mm f77</lens> <lens>pentax 1.2mm f10</lens> <lens>pentax 2.8mm f135</lens> </lenses>
the code following:
[xmltype("photographer")] public class samecameradto { [xmlattribute("name")] public string name { get; set; } [xmlattribute("primary-camera")] public string primarycameramake { get; set; } [xmlarray("lenses")] public list<lensdto> lenses { get; set; } } public class lensdto { [xmlelement("lens")] public string data { get; set; } }
how can remove "lensdto" tag ?
Comments
Post a Comment