XElement.Save (TextWriter, SaveOptions) serializes this element to a TextWriter
Imports System
Imports System.Xml
Imports System.Xml.XPath
Imports System.IO
Public Class MainClass
Public Shared Sub Main()
Dim root As XElement = <Root><Child> Text </Child></Root>
Using sw = New StringWriter()
root.Save(sw, SaveOptions.DisableFormatting)
Console.WriteLine(sw.ToString())
End Using
Using sw = New StringWriter()
root.Save(sw, SaveOptions.None)
Console.WriteLine(sw.ToString())
End Using
End Sub
End Class
Related examples in the same category