To convert XNode to XElement in C# and VB.NET you can use the following snippet.
Samples
Sample C#
1 2 3 4 |
public XElement XNodeToXElement(XNode xNode) { return XElement.Parse(xNode.ToString()); } |
Sample VB.NET
1 2 3 |
Public Function XNodeToXElement(xNode As XNode) As XElement Return XElement.Parse(xNode.ToString()) End Function |
If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.
Related links: