I have a custom object that has a string property called "Name". I would like to keep the serialization generated XML the same, but add an attribute to the element named "NiceName" with the value "Full Name".
This is what I have:
<TheObject> <Name>mr nobody</Name> </TheObject>
This is what I would like to generate:
<TheObject> <Name NiceName='Full name'>mr nobody</Name> </TheObject>
I only need this for some XSLTs, so I donβt want to change the way the class works, if possible. I.E. Change the name from a string to a custom class. All objects will have the same attribute that it will never change, it will be fully read.
c # xml serialization
Jammy
source share