To convert a XMLDocument to XDocument in C# and VB.NET you can use the following extensions method.
Sample C#
private XDocument ToXDocument(this XmlDocument xmlDocument) { return XDocument.Parse(xmlDocument.OuterXml); }
Sample VB.NET
<System.Runtime.CompilerServices.Extension> _ Private Function ToXDocument(xmlDocument As XmlDocument) As XDocument Return XDocument.Parse(xmlDocument.OuterXml) End Function
for more informations see the MSDN: XmlDocument Class,XDocument-Class
RT @CodeSnippetsNET: How to convert a XMLDocument to XDocument in .NET http://t.co/Xbc4YpOhVn #csharp #vb #dotnet