I am using the XML serializer. I would like it to convert all my object's elements, but it only seems to output tags when there is a value.
How can I get it to output empty tags?
I am using the XML serializer. I would like it to convert all my object's elements, but it only seems to output tags when there is a value.
How can I get it to output empty tags?
If I understand correctly, then not without implementing IXmlSerializable (which is not fun; don't go there). There are things like the ShouldSerialize* / *Specified patterns, but it still won't write something for nulls (even if you return true).
Take a look at a couple of options on how to solve this problem here:
http://danshultz.blogspot.com/2008/02/xmlserialization-nullempty-elements.html