i am serializing xml files using the XmlSerializer. It works just fine:
[XmlRoot(ElementName = "Wire"]
public class Wire
{
[XmlElement(ElementName = "Powerrail"]
public string Powerrail { get; set; }
[XmlElement(ElementName = "IdentCon"]
public IdentCon IdentCon { get; set; }
[XmlElement(ElementName = "NameCon"]
public List<NameCon> NameCon { get; set; }
[XmlAttribute(AttributeName = "UId")]
public string UId { get; set; }
}
<Wire UId="62">
<NameCon UId="51" Name="out" />
<NameCon UId="52" Name="in" />
</Wire>
<Wire UId="63">
<IdentCon UId="22" />
<NameCon UId="52" Name="operand" />
</Wire>
<Wire UId="64">
<NameCon UId="52" Name="out" />
<NameCon UId="53" Name="i_xOff1" />
</Wire>
But now i want to add comments to the xml file, something like this:
<Wire UId="62"> <!-- Wire from Location 1 -->
<NameCon UId="51" Name="out" />
<NameCon UId="52" Name="in" />
</Wire>
<Wire UId="63"> <!-- Wire from Location 2 -->
<IdentCon UId="22" />
<NameCon UId="52" Name="operand" />
</Wire>
<Wire UId="64"> <!-- Wire from Location 3 -->
<NameCon UId="52" Name="out" />
<NameCon UId="53" Name="i_xOff1" />
</Wire>
Can i achieve this using the XmlSerializer? Thanks a lot!