public int Compare(object x, object y) { Persoana p1 = x as Persoana; Persoana p2 = y as Persoana; return(string.Compare(p1.nume, p2.nume)); }
static void Main(string[] args) { Persoana p = new Persoana("George", 20); ArrayList persoane = new ArrayList(); persoane.Add(new Persoana("David", 21)); persoane.Add(new Persoana("Andrei", 20)); persoane.Sort(p); Console.WriteLine(persoane[0] + " " + persoane[1]); Console.ReadKey(); }