title: Why does HttpException.GetHttpCode() return an int instead of a System.Net.HttpStatusCode?
body: <p>I know I can just typecast the result from <a href="http://msdn.microsoft.com/en-us/library/system.web.httpexception.gethttpcode.aspx" rel="nofollow">GetHttpCode()</a> to <a href="http://msdn.microsoft.com/en-us/library/system.net.httpstatuscode.aspx" rel="nofollow">HttpStatusCode</a>, but I don't like to typecast enums. Especially because the MSDN doc doesn't explicitely say that the values of the enums are always the exact corresponding http status code.</p>
  
  <p>I feel that <a href="http://msdn.microsoft.com/en-us/library/system.web.httpexception.gethttpcode.aspx" rel="nofollow">GetHttpCode()</a> should just return <a href="http://msdn.microsoft.com/en-us/library/system.net.httpstatuscode.aspx" rel="nofollow">HttpStatusCode</a>.</p>
  
  <p>Should I just stop complaining and typecast?</p>
  
  <pre><code>catch(HttpException ex)
  {
      switch((HttpStatusCode)ex.GetHttpCode())
      {
          case HttpStatusCode.NotFound: 
              // Do stuff...
              break;
          // More cases...
      }
  }
  </code></pre>
  
  <p>EDIT: note that <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.statuscode.aspx" rel="nofollow">HttpWebResponse.StatusCode</a> <em>is</em> of type <a href="http://msdn.microsoft.com/en-us/library/system.net.httpstatuscode.aspx" rel="nofollow">HttpStatusCode</a></p>