title: Jump to certain line in code C#
body: <p>I have a few methods that are called from within a few other methods. When in some of the methods a certain action is performed, I would like to go back to the very first method and skip the rest of the code. At the moment, I use <code>booleans</code> to check the "status" of the program but I would like to avoid this because the methods should be <code>void</code> since in essence they don't need to return anything. I found stuff like <code>goto</code> but that only works in the same method.</p>
  
  <p><strong>Question</strong>: is there a way to jump to a specific point in the code in a different method in C#? I found stuff on other languages but not a lot on C#.</p>
  
  <p><strong>Current situation:</strong></p>
  
  <pre><code>    void test1()
      {
          bool status = test2();
  
          if (!status)
              return; // the other stuff will not get done
  
          Debug.WriteLine("Initialization OK");
      }
  
      bool test2()
      {
          bool status = test3();
  
          if (!status)
              return false; // the other stuff will not get done
  
          // do other stuff 
          return true;
      }
  
      bool test3()
      {
          if (xxx)
              return false; // the other stuff will not get done
          else
              // do other stuff 
              return true;
      }
  </code></pre>
  
  <p><strong>Wanted situation:</strong></p>
  
  <pre><code>    void test1()
      {
          test2();
  
          // do other stuff
          Debug.WriteLine("Initialization OK");
  
          GOTOHERE:
               Debug.WriteLine("Initialization NOT OK");
      }
  
      void test2()
      {
          test3();            
          // do other stuff 
      }
  
      void test3()
      {
          if (xxx)
              **GOTOHERE**; // Go directly to the location in test1() so that all unnecessary code is skipped
  
          // do other stuff
      }
  </code></pre>