Beispiel #1
0
        static void Main(string[] args)
        {
            CustomArrayList carPartsList = new CustomArrayList();

            carPartsList.Add("Tires");
            carPartsList.Add("Oil");
            carPartsList.Add("Sway bar");
            carPartsList.Add("Brakes");
            carPartsList.Remove("Oil");
            Console.WriteLine("We need to buy:");
            for (int i = 0; i < carPartsList.Count; i++)
            {
                Console.WriteLine(carPartsList[i]);
            }
            Console.WriteLine("Do we have to buy Tires? " +
                              carPartsList.Contains("Tires"));
        }
        static void Main(string[] args)
        {
            CustomArrayList shoppingList = new CustomArrayList();

            shoppingList.Add("Milk");
            shoppingList.Add("Honey");
            shoppingList.Add("Olives");
            shoppingList.Add("Beer");
            shoppingList.Add("Olives");

            shoppingList.Remove("Olives");

            Console.WriteLine("We need to buy:");
            for (int i = 0; i < shoppingList.Count; i++)
            {
                Console.WriteLine(shoppingList[i]);
            }
            Console.WriteLine("Do we have to buy Bread? " +
                              shoppingList.Contains("Bread"));
        }