It sounds like you really want a loop. I'd write it as:
bool successful = false;
while (!successful)
{
try
{
while(true)
{
// I hope you have a break in here somewhere...
}
successful = true;
}
catch (...)
{
...
}
}
You might want to use a do
/while
loop instead; I tend to prefer straight while
loops, but it's a personal preference and I can see how it might be more appropriate here.
I wouldn't use goto
though. It tends to make the code harder to follow.
Of course if you really want an infinite loop, just put the try/catch
inside the loop:
while (true)
{
try
{
...
}
catch (Exception)
{
...
}
}