我有一段像下面这样的代码:
try
{
Work:
while(true)
{
// Do some work repeatedly...
}
}
catch(Exception)
{
// Exception caught and now I can not continue
// to do my work properly
// I have to reset the status before to continue to do my work
ResetStatus();
// Now I can return to do my work
goto Work;
}
相比使用goto
,有更好的替代方法吗?或者说这是一个好的解决方案吗?