Serializing to Files, TextWriters, and XmlWriters
If you want to suppress formatting when serializing to a string, you can use the XNode.ToString method.
The default behavior when serializing to a file is to format (indent) the resulting XML document. When you indent, the insignificant white space in the XML tree is not preserved. To serialize with formatting, use one of the overloads of the following methods that do not take SaveOptions as an argument:
If you want the option not to indent and to preserve the insignificant white space in the XML tree, use one of the overloads of the following methods that takes SaveOptions as an argument:
For examples, see the appropriate reference topic.
Send feedback about: