using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharpCollectionsPart1
{
    class Program
    {
        class Empty
        { }

        static void Main(string[] args)
        {
            #region ArrayList First Example
            ArrayList da = new ArrayList();

            da.Add("Visual Basic");
            da.Add(344);
            da.Add(55);
            da.Add(new Empty());
            da.Remove(55);

            foreach (object el in da)
            {
                Console.WriteLine(el);
            }
            #endregion

            #region ArrayList Second Example
            // Creates and initializes a new ArrayList.
            ArrayList myAL = new ArrayList();
            myAL.Add("Hello");
            myAL.Add("World");
            myAL.Add("!");

            // Displays the properties and values of the ArrayList.
            Console.WriteLine("myAL");
            Console.WriteLine("    Count:    {0}", myAL.Count);
            Console.WriteLine("    Capacity: {0}", myAL.Capacity);
            Console.Write("    Values:");
            PrintValues(myAL); 
            #endregion

        }

        public static void PrintValues(IEnumerable myList)
        {
            foreach (Object obj in myList)
                Console.Write("   {0}", obj);
            Console.WriteLine();
        }

    }
}
