开发者

Can the XML serializer output empty tags?

开发者 https://www.devze.com 2022-12-25 13:15 出处:网络
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.

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?


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


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号