How can I check if IOException is a \"Not enough disk space\" exception type?
At the moment I check to see if the message matches something like \"Not e
In .NET 4.5, the HResult property getter is now Public, so you do not have to use Marshal.GetHRForException (along with its side affects) anymore.
http://msdn.microsoft.com/en-us/library/system.exception.hresult(v=vs.110).aspx states "Starting with the .NET Framework 4.5, the HResult property's setter is protected, whereas its getter is public. In previous versions of the .NET Framework, both getter and setter are protected"
So you can use Justin's answer, but replace Marshal.GetHRForException(ex) with ex.HResult.