using System; using System.Collections.Generic; interface IStrategy { bool DoSomething(); string Description {get; set;} } class StratFap : IStrategy { public bool DoSomething() {Console.WriteLine("fap"); return true;} public string Description {get; set;} } class StratQuit : IStrategy { public bool DoSomething() {Console.WriteLine("Bye!"); return false;} public string Description {get; set;} } class MenuPoint { public string Input {get; set;} public IStrategy Strat {get; set;} public MenuPoint(string input, IStrategy strat){ Input = input; Strat = strat; } } class Program { static void Main() { List menu= new List(); menu.Add(new MenuPoint("dick", new StratFap() {Description = "fap"})); menu.Add(new MenuPoint("q", new StratQuit() {Description = "quit"})); GUI(menu); } static void GUI(List menu) { bool keepGoing = new bool(); int ind = new int(); string input; ConsoleGui: foreach (var item in menu) Console.WriteLine($"Enter \"{item.Input}\" to {item.Strat.Description}"); input = Console.ReadLine(); ind = -1; for (int i = 0; i < menu.Count; i++) if (menu[i].Input == input) ind = i; if (ind >= 0) keepGoing = menu[ind].Strat.DoSomething(); else {Console.WriteLine("Bad input, try again"); goto ConsoleGui;} if (keepGoing) goto ConsoleGui; } }