Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // difference between Array and ArrayList --> Arrays are fixed sized so adding elements is troublesome...

            CustomArrayList <string> shoppingList = new CustomArrayList <string>();

            // this list is a joke and not reflective of my drinking habits
            shoppingList.Add("Milk");
            shoppingList.Add("Beer");
            shoppingList.Add("Whiskey");
            shoppingList.Add("Vodka");
            shoppingList.Add("Bread");
            shoppingList.Add("Rice");
            shoppingList.Add("Pork Belly");

            Console.WriteLine("I drink too much {0}", shoppingList[3]);

            Console.WriteLine("Here's the shopping list: ");
            for (int i = 0; i < shoppingList.Count; i++)
            {
                Console.WriteLine(" - " + shoppingList[i]);
            }
        }