title: How to get Exception Error Code in C#
body: <pre><code>try
  {
       object result = processClass.InvokeMethod("Create", methodArgs);
  }
  catch (Exception e)
  {  
      // Here I was hoping to get an error code.
  }
  </code></pre>
  
  <p>When I invoke the above WMI method I am expected to get Access Denied. In my catch block I want to make sure that the exception raised was indeed for Access Denied. Is there a way I can get the error code for it ? Win32 error code for Acceess Denied is 5.
  I dont want to search the error message for denied string or anything like that. </p>
  
  <p>Thanks</p>