private static void CommandExecutor(ref GenericCollection <string> genericCollection, string input, ref string result) { string[] commandOfArgs = input .Split(' '); switch (commandOfArgs[0]) { case "Add": genericCollection.Add(commandOfArgs[1]); break; case "Remove": int index = int.Parse(commandOfArgs[1]); genericCollection.Remove(index); break; case "Contains": result = genericCollection.Contains(commandOfArgs[1]).ToString(); break; case "Swap": int index1 = int.Parse(commandOfArgs[1]); int index2 = int.Parse(commandOfArgs[2]); genericCollection.Swap(index1, index2); break; case "Greater": result = genericCollection.CountGreaterThan(commandOfArgs[1]).ToString(); break; case "Max": result = genericCollection.Max(); break; case "Min": result = genericCollection.Min(); break; case "Sort": Sorter sorter = new Sorter(); genericCollection = sorter.Sort(genericCollection); break; case "Print": result = genericCollection.Print(); break; } }