static void Main(string[] args) { MyArrayList <int> testArray = new MyArrayList <int>(); MyArrayList <string> testArrayStr = new MyArrayList <string>(); try { for (int i = 0; i < 10; i++) { testArray.Add(i); testArrayStr.Add(i); } testArray.Insert(5, 100); for (int i = 0; i < testArray.Count; i++) { Console.WriteLine(testArray.Get(i)); } Console.WriteLine("Hello World!"); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { MyArrayList arrayList = new MyArrayList(); arrayList.Add(5); Console.WriteLine("was added " + arrayList[0]); arrayList.Add("str"); Console.WriteLine("was added " + arrayList[1]); Console.WriteLine("Count of items: " + arrayList.Count); arrayList.Clear(); Console.WriteLine("The list was cleared. Count of items: " + arrayList.Count); Console.Read(); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); MyArrayList myArrayList = new MyArrayList(); myArrayList.Add(5); myArrayList.Add("ff"); myArrayList.Add("sds"); myArrayList.Add("sdas"); foreach (var show in myArrayList) { Console.WriteLine(show); } }
static void Main(string[] args) { MyArrayList arrlist = new MyArrayList(10); arrlist.printAll(); arrlist.isEmpty(); arrlist.addFront(10); arrlist.Insert(1, 5); arrlist.Insert(2, 15); arrlist.Insert(3, 20); arrlist.Sort(); arrlist.printAll(); arrlist.addFront(1); arrlist.addBack(30); arrlist.printAll(); arrlist.contains(20); arrlist.Sort(); arrlist.printAll(); arrlist.Clear(); Console.WriteLine($"The size of 'arrlist' is: {arrlist.size()} elements"); }