how to specify xml element having a xml attribute
What should be the class structure such that it serializes in the format given below
<Header>
<Version environment="debug">2.2</Version&开发者_JAVA技巧gt;
</Header>
[XmlRoot] public class Header { [XmlElement] public string Version{get;set;} }
[XmlRoot]
public class Header
{
[XmlElement]
public Version Version { get; set; }
}
public class Version
{
[XmlAttribute("environment")]
public String Environment { get; set; }
[XmlText]
public String Value { get; set; }
}
精彩评论