I'm using XmlSerializer to serialize and de-serialize my xml files.
But is there a way to add a comment. I cant find it.
Something like this is what I have tried.
[XmlElement("Name")]
[XmlComment("This is the name property")]
public String Name
{
get { return this._name; }
set { this._name = value; }
}
This is the code that serializes the Xml
var serializer = new XmlSerializer(typeof(SomeObject));
using (var writer = new StreamWriter(@"c:\path\to\file.xml"))
{
serializer.Serialize(writer, scene);
}
There for hoping to get the output of
<SomeObject>
<!-- This is the name property -->
<Name>My Name is John</Name>
</SomeObject>
Ive looked everywhere. Its probably not available.