using System; using System.Collections; namespace CollectionsTest2 { public class Dog { public string name; public Dog (string s) { name = s; } } /// /// Summary description for Class1. /// class Class1 { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Dog d1, d2, d3, d4; d1 = new Dog ("FIFO"); d2 = new Dog ("FILO"); d3 = new Dog ("LIFO"); d4 = new Dog ("LILO"); /*ArrayList a = new ArrayList(); a.Add(d1); a.Add(d2); a.Add(d3); a.Add(d4); Dog temp = (Dog)a[0]; */ Stack s = new Stack(); s.Push(d1); s.Push(d2); s.Push(d3); s.Push(d4); Dog temp = (Dog)(s.Pop()); Console.WriteLine(temp.name); Console.ReadLine(); } } }