Return XML, optionally disabling formatting in CSharp
Description
The following code shows how to return XML, optionally disabling formatting.
Example
/*from w w w . jav a 2 s . com*/
using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass{
public static void Main(){
XElement root = XElement.Parse("<Root><Child/></Root>");
Console.WriteLine(root.ToString(SaveOptions.DisableFormatting));
Console.WriteLine("---");
Console.WriteLine(root.ToString(SaveOptions.None));
}
}