Is it possible to create a method/extension to try-catch a piece of code within some brachets? For example:
public static void TryCatchrep(//CODEHERE)
    {
        bool t;
        do
        {
            try
            {
                //CODEHERE
                t = true;
            }
            catch
            {
                //ERROR
                t = false;
            }
        } while (t == false); //Repeats on catch
        
    }
 
    