Can an XML serializer output empty tags?

I am using an XML serializer. I would like it to convert all my object objects, but it only seems to display tags when there is a value.

How can I get it to display empty tags?

+4
source share
2 answers
+6
source

If I understand correctly, then not without the implementation of IXmlSerializable (which is not fun, not there). There are things like ShouldSerialize* / *Specified templates, but it still won't write anything for null (even if you return true).

+1
source

Source: https://habr.com/ru/post/1306050/


All Articles