Mega Code Archive

 
Categories / C# / XML LINQ
 

XElement FirstAttribute gets the first attribute 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 xmlTree = new XElement("Root",             new XAttribute("Att1", 1),             new XAttribute("Att2", 2),             new XAttribute("Att3", 3)         );         Console.WriteLine(xmlTree.FirstAttribute);     } }