Mega Code Archive

 
Categories / C# / XML LINQ
 

XElement SetValue sets the value of this element

using System; using System.Linq; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass{    public static void Main(){         XElement root = new XElement("Root",             new XElement("Child", "child content")         );         root.SetValue("new content");         Console.WriteLine(root);    } }