title: Is this an abuse of try/finally?
body: <p>Given that <strong>multiple return statements are acceptable</strong> (I sort of disagree, but <a href="https://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement">let us digress</a>), I'm looking for a more acceptable way to achieve the following behavior:</p>
  
  <p><strong>Option A</strong>: multiple returns, repeated code block</p>
  
  <pre><code>public bool myMethod() {
      /* ... code ... */
  
      if(thisCondition) {
          /* ... code that must run at end of method ... */
          return false;
      }
  
      /* ... more code ... */
  
      if(thatCondition) {
          /* ... the SAME code that must run at end of method ... */
          return false;
      }
  
      /* ... even more code ... */
  
      /* ... the SAME CODE AGAIN that must run at end of method ... */
      return lastCondition;
  }
  </code></pre>
  
  <p>It makes me feel dirty to see the same (little) code block repeated three times each time the method returns. Furthermore, I would like to clarify that the two <code>return false</code> statements above can certainly be described as returning mid-method... they are absolutely not "guard statements."</p>
  
  <p>Is Option B <em>slightly</em> more acceptable? I feel that I may abusing try/finally, and I'm hoping there is something completely different that I <em>should</em> be doing.</p>
  
  <p><strong>Option B</strong>: multiple returns, <strong>try/finally</strong> block (without catch blocks / exceptions)</p>
  
  <pre><code>public bool myMethod() {
      try {
          /* ... code ... */
  
          if(thisCondition) {
              return false;
          }
  
          /* ... more code ... */
  
          if(thatCondition) {
              return false;
          }
  
          /* ... even more code ... */
  
          return lastCondition;
      } finally {
          /* ... code that must run at end of method ... */
      }
  }
  </code></pre>
  
  <p>Finally, Option C is the best solution in <em>my</em> book, but my team doesn't like this approach for whatever reason(s), hence I'm looking for a compromise.</p>
  
  <p><strong>Option C</strong>: single return, conditional blocks</p>
  
  <pre><code>public bool myMethod() {
      /* ... code ... */
  
      if(!thisCondition) {
          /* ... more code ... */
      }
  
      if(!thisCondition &amp;&amp; !thatCondition) {
          /* ... even more code ... */
      }
  
      /* ... code that must run at end of method ... */
      return summaryCondition;
  }
  </code></pre>
  
  <p>If you want to discuss multiple return statements, please do so in <a href="https://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement">this question</a>.</p>