I'm trying to deserialize some xml to c# classes, and i would like to merge one element into its parrent. The xml looks like this:
<Root ID="1" Name="Foo">
<Header TableName="Bar" TableVersion="3" TableID="2" CreatedDate="2014-08-9T11:41:02"/>
<Element></Element>
<Element></Element>
<Element></Element>
<Element></Element>
<Element></Element>
<Element></Element>
</Root>
Now i would like to combine the "root" attributes with the "header" attributes in one class like:
public class RootElement
{
[XmlAttribute]
public int Id { get; set; }
[XmlAttribute]
public String Name { get; set; }
[XmlAttribute]
public String TableName { get; set; }
[XmlAttribute]
public int TableVersion { get; set; }
[XmlAttribute]
public int TableId { get; set; }
[XmlAttribute]
public DateTime CreatedDate { get; set; }
}
I'm guessing i should use a prefix on the attributes from the "header" element.
Thank you in advance.
No comments:
Post a Comment