Mega Code Archive

 
Categories / C# / XML LINQ
 

Returns a filtered collection of attributes 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", "content1"),             new XAttribute("Att2", "content2")         );         IEnumerable<XAttribute> attList = xmlTree.Attributes("Att1");         foreach (XAttribute att in attList)             Console.WriteLine(att);     } }