static void Main(string[] args) { // MENU string[] items = { "Create file", "Start folder monitoring", "View Data", "Exit" }; method[] methods = new method[] { RunOpenFileVertion, RunConsoleVersion, DisplayData, Exit }; Task4Menu menu = new Task4Menu(items); int menuResult; do { menuResult = menu.PrintMenu(); Console.WriteLine(); methods[menuResult](); } while (menuResult != items.Length - 1); }
static void Main(string[] args) { // MENU string[] items = { "Install Service", "Run Service", "Stop service", "Uninstall service", "Exit" }; method[] methods = new method[] { InstallService, RunService, StopService, UninstallService, Exit }; Task4Menu menu = new Task4Menu(items); int menuResult; do { menuResult = menu.PrintMenu(); Console.WriteLine(); methods[menuResult](); } while (menuResult != items.Length - 1); }