I\'ve seen a suggested coding standard that reads Never use goto unless in a switch statement fall-through.
I don\'t follow. What exactly would this \'
public enum ExitAction {
Cancel,
LogAndExit,
Exit
}
This is neater
ExitAction action = ExitAction.LogAndExit;
switch (action) {
case ExitAction.Cancel:
break;
case ExitAction.LogAndExit:
Log("Exiting");
goto case ExitAction.Exit;
case ExitAction.Exit:
Quit();
break;
}
Than this (especially if you do more work in Quit())
ExitAction action = ExitAction.LogAndExit;
switch (action) {
case ExitAction.Cancel:
break;
case ExitAction.LogAndExit:
Log("Exiting");
Quit();
break;
case ExitAction.Exit:
Quit();
break;
}