static void InintArr() { baseinventory[0] = new Economicgames("Monopoly", 10, "Game on Board", "Economy", 4, 2); baseinventory[1] = new Logicgames("Chess", 12, "Game on Board", "Logic", "wood", "plastic"); baseinventory[2] = new Bowls("MadBall", 20, "Game on street", "on floor", 10, "wood"); baseinventory[3] = new Tenis("FunyBalls", 25, "Game on street", "on table", "USA", "China"); }
static void AddArr() { BaseInventory[] newbasinventory = new BaseInventory[baseinventory.Length + 1]; for (int i = 0; i < baseinventory.Length; i++) { newbasinventory[i] = baseinventory[i]; } baseinventory = newbasinventory;// while (true) { Console.Clear(); char[] arr = new char[28] { '+', '-', '-', '-', '-', '-', '-', '-', '-', '-', 'A', 'd', 'd', ' ', 'm', 'e', 'n', 'u', '-', '-', '-', '-', '-', '-', '-', '-', '-', '+' }; for (int i = 0; i < 28; i++) { Console.Write(arr[i]); Thread.Sleep(50); Console.SetCursorPosition(i + 1, 0); } Console.WriteLine(); StringBuilder sb = new StringBuilder(); sb.Append("| 1- "); sb.Append((Menuprint)0); sb.AppendLine(" |"); sb.Append("| 2- "); sb.Append((Menuprint)1); sb.AppendLine(" |"); sb.Append("| 3- "); sb.Append((Menuprint)2); sb.AppendLine(" |"); sb.Append("| 4- "); sb.Append((Menuprint)3); sb.AppendLine(" |"); sb.AppendLine("| 5- Exit |"); sb.AppendLine("+--------------------------+"); Console.WriteLine(sb); string choice = Console.ReadLine(); Console.Clear(); switch (choice) { case "1": BaseInventory ecogame = new Economicgames(); ecogame.AddInventry(); baseinventory[baseinventory.Length - 1] = ecogame; break; case "2": BaseInventory logicgame = new Logicgames(); logicgame.AddInventry(); baseinventory[baseinventory.Length - 1] = logicgame; break; case "3": BaseInventory Bowls = new Bowls(); Bowls.AddInventry(); baseinventory[baseinventory.Length - 1] = Bowls; break; case "4": BaseInventory Ping = new Tenis(); Ping.AddInventry(); baseinventory[baseinventory.Length - 1] = Ping; break; case "5": break; } break; } }