private static KeyValuePair getUserAction(string choices) { //whether or not the userAction is valid bool actionIsValid = false; //From the choices string, parse out the optional actions, returned as a key:action Dictionary validAnwers = FindActionKeys(choices); do { //Get the user's choice of action string action = Tools.Prompt("What do you want to do?\n{0}", choices); //Verify that it's in the keys of the validAnswers if (validAnwers.ContainsKey(action)) { //Tools.Print("you have chosen wisely and a valid key.\n\n"); //Tools.Print(validAnwers[action]); //return action; return new KeyValuePair(action, validAnwers[action]); } else { Tools.Print(newFG: ConsoleColor.Red, text: "Incorrect key, please type exactly the letter you're looking for.\n"); //return action; } } while (!actionIsValid); //since the loop is done, the action is considered valid, and returned //return action; return new KeyValuePair("invalid", "invalid");