在使用标准的.NET XML序列化程序时,有没有办法隐藏所有空值?下面是我的类的输出示例.如果可以为空的整数设置为NULL,我不想输出它们.
当前Xml输出:
<?xml version="1.0" encoding="utf-8"?>
<myClass>
<myNullableInt p2:nil="true" xmlns:p2="http://www.w3.org/2001/XMLSchema-instance" />
<myOtherInt>-1</myOtherInt>
</myClass>
我想要的是:
<?xml version="1.0" encoding="utf-8"?>
<myClass>
<myOtherInt>-1</myOtherInt>
</myClass>