Is it possible to execute the code in the try block again after an exception in caught in catch block?

后端 未结 7 827
灰色年华
灰色年华 2021-02-05 06:18

I want to execute the code in the try block again after an exception is caught. Is that possible somehow?

For Eg:

try
{
    //execute some code
}
catch(E         


        
7条回答
  •  北海茫月
    2021-02-05 06:50

    What's wrong with the ole goto?

     Start:
                try
                {
                    //try this
                }
                catch (Exception)
                {
    
                    Thread.Sleep(1000);
                    goto Start;
                }
    

提交回复
热议问题