public TestCollections(int size) { Size = size; for (int i = 0; i < size; i++) { Diesel dies = new Diesel(); dies = dies.MakeRandom(); stackEng.Push(dies.BaseEngine()); stackStr.Push(dies.ToString()); dictEng.Add(dies.BaseEngine(), dies); dictStr.Add(dies.ToString(), dies); } }
static void AddElement(Queue collection) { int menu = 10; bool random; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("0. Добавить Engine"); Console.WriteLine("1. Добавить InternalCEngine"); Console.WriteLine("2. Добавить Diesel"); Console.WriteLine("3. Добавить TurbojetEngine"); Console.ResetColor(); menu = InputMenu(3); Console.WriteLine("Введите 1, если надо применить рандомный элемент, и 0, если нет"); random = InputNum(1) == 1; switch (menu) { case 0: if (random) { collection.Enqueue(eng1.MakeRandom()); } else { collection.Enqueue(CreateEng()); } break; case 1: if (random) { collection.Enqueue(iEng1.MakeRandom()); } else { collection.Enqueue(CreateIEng()); } break; case 2: if (random) { collection.Enqueue(dies1.MakeRandom()); } else { collection.Enqueue(CreateDies()); } break; case 3: if (random) { collection.Enqueue(turb1.MakeRandom()); } else { collection.Enqueue(CreateTurb()); } break; } }