Если вы должны были разобрать этот код:
Sub Main()
Dim doc As XDocument = <?xml version="1.0" encoding="utf-8"?>
<!--Application Version: VERSION HERE-->
<SEPUnits></SEPUnits>
doc.Save("test.xml")
End Sub
Вы увидите, что VB просто выполняет за вас часть работы:
Public Shared Sub Main()
Dim VB$t_ref$S0 As New XDocument(New XDeclaration("1.0", "utf-8", Nothing), Nothing)
VB$t_ref$S0.Add(New XComment("Application Version: VERSION HERE"))
Dim VB$t_ref$S1 As New XElement(XName.Get("SEPUnits", ""))
VB$t_ref$S1.Add("")
VB$t_ref$S0.Add(VB$t_ref$S1)
VB$t_ref$S0.Save("test.xml")
End Sub
Я новичок в XML-литералах, поэтому может быть простой способ вставить XComment в ваш XML, или вы можете просто создать XML, как они делают в C #:
Dim version As String = "1.0.0.1"
Dim doc As New XDocument(New XDeclaration("1.0", "utf-8", Nothing), New XComment("Application Version: " & Version), New XElement("customers"))
Doc.ToString будет отображаться как:
<?xml version="1.0" encoding="utf-8" ?>
<!-- Application Version: 1.0.0.1-->
<customers />