static void ArrayList() { System.Console.WriteLine("\n===== MyArrayList =====\n"); MyArrayList al = new MyArrayList(10); System.Console.WriteLine(al); al.Add(2); al.Add(3); al.Add(5); System.Console.WriteLine(al); Console.WriteLine(al.Get(0)); try { Console.WriteLine(al.Get(3)); } catch (MyArrayListIndexOutOfRangeException e) { Console.WriteLine(e.Message); } al.Set(2, 4); System.Console.WriteLine(al); al.Clear(); for (int i = 0; i < 10; i++) { al.Add(i); } al.Set(9, 2); al.Set(7, 2); System.Console.WriteLine(al); Console.WriteLine(al.CountOccurences(2)); Console.WriteLine($"value exist: {al.CheckValueExist(10)}"); Console.WriteLine($"value exist: {al.CheckValueExist(2)}"); }