Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Created November 15, 2020 15:44
Show Gist options
  • Save joe-oli/26af5235a2ebe64f40a0f001decf3004 to your computer and use it in GitHub Desktop.
Save joe-oli/26af5235a2ebe64f40a0f001decf3004 to your computer and use it in GitHub Desktop.
XmlElement to XElement + vice versa
Convert XmlElement to XElement
---
Private Function ConvertToXmlElement(ByVal elem As XElement) _
As XmlElement
Dim xmldoc As New XmlDocument()
xmldoc.Load(elem.CreateReader())
Return xmldoc.DocumentElement
End Function
Convert XElement to XmlElement
---
Private Function ConvertToXElement(ByVal elem As XmlElement) As XElement
Return XElement.Parse(elem.OuterXml)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment