// 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.Collections.Generic;
using System.Xml;
namespace E
{
public class Program
{
public static void Main(string[] args)
{
string xmlstr = @"
";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlstr);
List apps = new List();
foreach(XmlElement app in doc.DocumentElement.GetElementsByTagName("application"))
{
apps.Add(app);
}
foreach(XmlElement app in apps)
{
Console.WriteLine(app.Attributes["description"].Value);
}
apps.Sort(delegate(XmlElement a1, XmlElement a2) { return a1.Attributes["description"].Value.CompareTo(a2.Attributes["description"].Value); });
foreach(XmlElement app in apps)
{
Console.WriteLine(app.Attributes["description"].Value);
}
}
}
}