Is there a way to force the XML serializer to add an element as inline rather than with the Value layout. I basically have just a giant list of structs and I’d like to add an inline element to each sub element that is enabled.
<main>
<item>
<value>1</value>
<name>Alphabet</name>
</item>
...
</main>
I basically want to add:
<item Enabled="true">
if the element block is enabled. IS there a way to do this?
Yes, just mark the Enabled property with the
XmlAttributeAttribute:Documentation on the attributes that control xml serialization can be found on MSDN:
http://msdn.microsoft.com/en-us/library/83y7df3e%28v=VS.100%29.aspx