XAttribute.ToString converts the current XAttribute object to a string representation.
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("Att1", "content1"), new XAttribute("Att2", "content2"), new XAttribute("Att3", "content3") ); XAttribute att = root.Attribute("Att2"); Console.WriteLine(att.ToString()); } }