How can I get rid of this goto?

24 Sep 2009 in software-development | csharp |

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…


comments powered by Disqus