Mega Code Archive

 
Categories / C# / XML LINQ
 

XAttribute Value gets or sets the value of this attribute

using System; using System.Linq; using System.Xml; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass{    public static void Main(){         XElement root = new XElement("Root",             new XAttribute("Att", "content")         );         XAttribute att = root.FirstAttribute;         Console.WriteLine(att.Value);         att.Value = "new text";         Console.WriteLine(att.Value);     } }