Created
July 20, 2012 12:11
-
-
Save rarous/3150395 to your computer and use it in GitHub Desktop.
Convert XElement to XmlElement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot!! It's very helpful.