XDocument.Save (TextWriter) serialize this XDocument to a TextWriter.
Imports System
Imports System.Text
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim sb As StringBuilder = New StringBuilder()
Dim doc As XDocument = _
<?xml version="1.0" encoding="utf-8"?>
<Root><Child>content</Child></Root>
Dim tr As TextWriter = New StringWriter(sb)
doc.Save(tr)
Console.WriteLine(sb.ToString())
End Sub
End Class