title: Enforcing an "end" call whenever there is a corresponding "start" call
body: <p>Let's say I want to enforce a rule:</p>
  
  <blockquote>
    <p>Everytime you call "StartJumping()" in your function, you must call "EndJumping()" before you return.</p>
  </blockquote>
  
  <p>When a developer is writing their code, they may simply forget to call EndSomething - so I want to make it easy to remember.</p>
  
  <p>I can think of only one way to do this: and it abuses the "using" keyword:</p>
  
  <pre><code>class Jumper : IDisposable {
      public Jumper() {   Jumper.StartJumping(); }
      public void Dispose() {  Jumper.EndJumping(); }
  
      public static void StartJumping() {...}
      public static void EndJumping() {...}
  }
  
  public bool SomeFunction() {
      // do some stuff
  
      // start jumping...
      using(new Jumper()) {
          // do more stuff
          // while jumping
  
      }  // end jumping
  }
  </code></pre>
  
  <p>Is there a better way to do this?</p>