Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这可能是一个幼稚的问题。但是,我只是想了解为什么工具提示说“保留”实际上它丢弃了不必要的空白。
这里有一个误导性的双重否定。您链接到的文档说(强调我的):
如果您不禁用格式化,则 XML 树中所有无关紧要的空白都将被丢弃,并且 XML 在序列化时被格式化(缩进)。
这意味着如果DisableFormatting 指定,则不会丢弃无关紧要的空白,即它将保留在序列化输出中。所以,工具提示是正确的。
DisableFormatting