title: What is the highest Cyclomatic Complexity of any function you maintain? And how would you go about refactoring it?
body: <p>I was doing a little exploring of a legacy system I maintain, with <a href="http://www.ndepend.com/" rel="noreferrer">NDepend</a> (great tool check it out), the other day. My findings almost made me spray a mouthful of coffee all over my screen. The top 3 functions in this system ranked by descending cyclomatic complexity are:</p>
  
  <ol>
  <li>SomeAspNetGridControl.CreateChildControls (CC of 171!!!) </li>
  <li>SomeFormControl.AddForm (CC of 94)</li>
  <li>SomeSearchControl.SplitCriteria (CC of 85)</li>
  </ol>
  
  <p>I mean 171, wow!!! Shouldn't it be <a href="https://stackoverflow.com/questions/20702/whats-your-a-good-limit-for-cyclomatic-complexity">below 20</a> or something? So this made me wonder. What is the most complex function you maintain or have refactored? And how would you go about refactoring such a method?</p>
  
  <p><strong>Note:</strong> The CC I measured is over the code, not the IL.</p>