// 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; class MainClass { public static void Main(string[] args) { ArrayList lst1 = new ArrayList(); lst1.Add("A"); lst1.Add("BB"); lst1.Add("CCC"); lst1.Add("BB"); lst1.Add("A"); foreach(string elm in lst1) Console.WriteLine(elm); Hashtable map = new Hashtable(); foreach(string elm in lst1) if(!map.ContainsKey(elm)) map.Add(elm, null); ArrayList lst2 = new ArrayList(); foreach(string elm in map.Keys) lst2.Add(elm); foreach(string elm in lst2) Console.WriteLine(elm); } }