static void Main(string[] args) { /** * An array that inclement its length automatically **/ MyArray array = new MyArray(3); array.Insert(10); array.Insert(11); array.Insert(12); array.Insert(13); array.Insert(14); array.Print(); }
static void Main(string[] args) { //fastest way to access by index O(1) //bad when need to resize O(n), good when we know the size O(1) var myArray = new MyArray <int>(1); myArray.Insert(10); myArray.Insert(20); myArray.Insert(30); myArray.Insert(40); Console.WriteLine(myArray.IndexOf(20)); myArray.RemoveAt(2); myArray.Print(); Console.ReadLine(); }