static void BoxingDemo() { SimpleArrayList sal = new SimpleArrayList(); sal.Add(3); int i = (int)sal.Get(0); SimpleGenericArrayList<int> sgal = new SimpleGenericArrayList<int>(); sgal.Add(3); int j = sgal.Get(0); SimpleGenericArrayList<Employee> sga = new SimpleGenericArrayList<Employee>(); }
static void SimpleListsDemo() { Location loc = new Location(); ISimpleList employees = new SimpleArrayList(); //ISimpleList employees = new SimpleLinkedList(); //SimpleGenericArrayList<Employee> employees = new SimpleGenericArrayList<Employee>(); HourlyPaidEmployee emp1 = new HourlyPaidEmployee(1, "Michael", "michael", loc, "1234"); SalariedEmployee emp2 = new SalariedEmployee(2, "Susan", "susan", loc, "5678", 6); employees.Add(emp1); employees.Add(emp2); SalariedEmployee semp = (SalariedEmployee)employees.Get(1); int grade = semp.PayGrade; Employee emp = (Employee) employees.Get(0); // need to cast emp.Move(new Location()); Employee target = new SalariedEmployee(1, null, null, null, null, 0); employees.Remove(target); // test IEnumerable version - remove for student download, will do in lab //SimpleEnumerableArrayList seal = new SimpleEnumerableArrayList(); //seal.Add("Plato"); //seal.Add("McDowell"); //seal.Add("Neal"); //seal.Add("Shedden"); //seal.Add("Kane"); //foreach (String s in seal) //{ // Console.WriteLine(s); //} Console.ReadLine(); }