Skip to content

Instantly share code, notes, and snippets.

@rarous
Created July 20, 2012 12:11
Show Gist options
  • Save rarous/3150395 to your computer and use it in GitHub Desktop.
Save rarous/3150395 to your computer and use it in GitHub Desktop.
Convert XElement to XmlElement
using System.Xml;
using System.Xml.Linq;
public static class XElementExtensions
{
public static XmlElement ToXmlElement(this XElement el)
{
var doc = new XmlDocument();
doc.Load(el.CreateReader());
return doc.DocumentElement;
}
}
@andreisfedotov
Copy link

๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

@ComSpex
Copy link

ComSpex commented May 5, 2021

Thanks a lot!! It's very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment