// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using System.Linq; using System.Xml.Linq; namespace E { public class Program { public static void Main(string[] args) { string xmlstr = @" "; XElement launch = XElement.Load(new StringReader(xmlstr)); var apps1 = from app in launch.Elements("application") select app; foreach(XElement app in apps1) { Console.WriteLine(app.Attribute("description").Value); } var apps2 = from app in launch.Elements("application") orderby app.Attribute("description").Value select app; foreach(XElement app in apps2) { Console.WriteLine(app.Attribute("description").Value); } } } }