以下是伪代码:
myGoto:
try
{
// do some db updating
myDB.doOptimisticConcurrency();
} catch (MyConcExeption ex) {
if (tried < fiveTimes) {
myDB.Refresh();
tried++;
goto myGoto;
}
}
我在一个方法中有几个 try-catch 块,我不想从一开始就为每个抛出的异常重新调用我的方法。goto
在这种情况下使用可以接受吗?