title: Suppressing Static Code Analysis Warning CA1806 for TryParse calls
body: <p>I was wondering what people's thoughts were on the <a href="http://msdn.microsoft.com/en-us/library/ms182273.aspx" rel="noreferrer">CA1806 (DoNotIgnoreMethodResults)</a>  Static Code Analysis warning when using FxCop.</p>
  
  <p>I have several cases where I use Int32.TryParse to pull in internal configuration information that was saved in a file.  I end up with a lot of code that looks like:</p>
  
  <pre><code>Int32.TryParse(someString, NumberStyles.Integer, CultureInfo.InvariantCulture, out intResult);
  </code></pre>
  
  <p>MSDN says the default result of intResult is zero if something fails, which is exactly what I want.</p>
  
  <p>Unfortunately, this code will trigger CA1806 when performing static code analysis.  It seems like a lot of redundant/useless code to fix the errors with something like the following:</p>
  
  <pre><code>bool success = Int32.TryParse(someString, NumberStyles.Integer, CultureInfo.InvariantCulture, out intResult);
  if (!success)
  {
   intResult= 0;
  }
  </code></pre>
  
  <p>Should I suppress this message or bite the bullet and add all this redundant error checking?  Or maybe someone has a better idea for handling a case like this?</p>
  
  <p>Thanks!</p>