How can I get rid of this goto?

September 24, 2009 in

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...

Previous & Next

Repository or DAO?: RepositoryASP.NET MVC: class / action, not method / action