Get or set the value of an attribute in CSharp
Description
The following code shows how to get or set the value of an attribute.
Example
using System;/*w w w.j a v a 2s . c om*/
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);
}
}