Replace XElement with xml in string (C#)
15 December, 2009
0 Comments
If you want to replace an existing XElement by an new XElement conctructed from a string, you can use the XElement ReplaceWith method:
XElement element = new XElement("MyName", "MyContent"); string newValue = "<MyNewName>Some value</MyNewName>"; element.ReplaceWith(XElement.Parse(newValue));Tags: C#, XML - XSLT - XPath
Thanks for this query!!! 🙂