有没有一种方法使用XML序列化时,为了避免自闭的标签?自闭、为了避免、标签、序列化

2023-09-04 11:59:46 作者:江畔秋时月

我正在与VB.NET,我面临着XML序列化的问题。当空值存在于我序列化对象,XML文件包含以下标签:

I am working with VB.NET and I am facing a problem with XML serialization. When empty values exists in the object I am serializing, the XML file contains the following tags:

<tagName/>

来代替:

<tagName></tagName>

我知道,这是相同的,但我想开始标签关闭适当。

I know that it's the same, but I want the start tag to close appropriately.

推荐答案

他们是相同的,这让的没有的区别。任何分析器或读者理解的意思,那么,为什么如此重要的变化?

They are the same and it makes no difference. Any parser or reader understands the meaning, so why is this so important to change?

我觉得目前的行为更好,因为它会导致的小的文件。

I find the current behavior better as it will result in smaller files.

不管如何,有没有办法来覆盖此行为。

Regardless, there is no way to override this behavior.