How can I get rid of this goto?
Help! It’s late and I don’t see a good way to get rid of this goto construct:
private void advanceTheTimeCursor(
Func<DateTime> nextTime,
Action uponSuccessfulAdvancement)
{
loop:
var t = nextTime();
if (t > reference) return;
uponSuccessfulAdvancement();
pastToPresentCursor = t;
goto loop;
}
I kinda like it, but somebody said somewhere gotos are considered harmful…