开发者

Can the XML serializer 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?


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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜