Esempio n. 1
0
        static void Main(string[] args)
        {
            MyArrayList <int> L = new MyArrayList <int>();

            for (int i = 0; i < 10; i++)
            {
                L.Add(i);
            }
            int[] arr = new int[30];
            L.RemoveAt(5);
            L.Remove(9);
            L.Contains(0);
            L.CopyTo(arr, 5);
            L.IndexOf(3);
            L.Insert(4, 5);
            L.Clear();
            Console.ReadLine();
        }
Esempio n. 2
0
        static void ShowArrayList(MyArrayList myArrayList)
        {
            Console.WriteLine($"Shows {nameof(myArrayList)}");
            Console.WriteLine($"Capacity {myArrayList.Capacity}");
            myArrayList.Add("123");
            Console.WriteLine($"Add 123");

            Console.WriteLine($"Capacity {myArrayList.Capacity}");

            Show(nameof(myArrayList), myArrayList, myArrayList.Capacity);

            Console.WriteLine("Update via index");
            myArrayList[0] = "hey i changed";
            Show(nameof(myArrayList), myArrayList, myArrayList.Capacity);

            Console.WriteLine("Clear");
            myArrayList.Clear();
            Show(nameof(myArrayList), myArrayList, myArrayList.Capacity);
            Console.WriteLine();
            Console.WriteLine("-------------------------");
        }