private void DisplayChoices(PromptChoiceItem <T> defaultChoice) { Console.WriteLine(Message); foreach (var choice in _choices) { Console.WriteLine(FormatDefault(choice, defaultChoice.Equals(choice))); } }
private T GetUserChoice(PromptChoiceItem <T> defaultChoice) { var userChoice = Console.ReadLine(); try { return(_choices.Single(choice => choice.Equals(userChoice)).Value); } catch (InvalidOperationException) { return(defaultChoice.Value); } }
private static string FormatDefault(PromptChoiceItem <T> choiceItem, bool isDefault) => $"{choiceItem}{(isDefault ? DefaultPostfix : string.Empty)}";