Writes raw markup manually from a string.
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlTextWriter writer = new XmlTextWriter (Console.Out); writer.Formatting = Formatting.Indented; writer.WriteStartElement("Items"); writer.WriteStartElement("Item"); writer.WriteString("Write unescaped text: "); writer.WriteRaw("this & that"); writer.WriteEndElement(); writer.WriteStartElement("Item"); writer.WriteString("Write the same string using WriteString: "); writer.WriteString("this & that"); writer.WriteEndElement(); writer.WriteEndElement(); writer.Close(); } }