Esempio n. 1
0
        static void Main(string[] args)
        {
            MyList<string> test = new MyList<string>(7);
            test.Add("lol0");
            test.Add("lol2");
            test.Add("lol1");
            Console.WriteLine("lol0 "+test.GetElementByIndex(0));
            Console.WriteLine("lol2 " + test.GetElementByIndex(1));
            Console.WriteLine("lol1 " + test.GetElementByIndex(2));
            Console.WriteLine("lol1 " + test.GetLastElement());
            test.RemoveLastElement();
            Console.WriteLine("lol2 " + test.GetLastElement());
            Console.WriteLine("2 "+test.getCount());
            test.RemoveFirstElement();
            Console.WriteLine("lol2 "+test.GetLastElement());
            Console.WriteLine("1 "+test.getCount());
            test.InsertElementAt(0, "lol2");
            Console.WriteLine("lol2 " + test.GetLastElement());
            test.InsertElementAt(1, "lol3");
            test.InsertElementAt(1, "lol4");
            Console.WriteLine("4 " +test.getCount());
            test.RemoveLastElement();
            Console.WriteLine("lol3 "+test.GetLastElement());
            test.RemoveLastElement();
            Console.WriteLine("lol4 " + test.GetLastElement());

            foreach (var item in test)
            {
                Console.WriteLine(item);
            }

            Console.Read();
        }