Converts the specified HRESULT error code to a corresponding Exception object.
![]()
An object that represents the converted HRESULT.
Use the erload:System.Runtime.InteropServices.Marshal.GetExceptionForHR method to get an Exception based on an HRESULT without having to call the erload:System.Runtime.InteropServices.Marshal.ThrowExceptionForHR method and catch the exception.
The current IErrorInfo interface is used to construct the exception.
For the mapping from each HRESULT to its comparable exception class in the .NET Framework, see How to: Map HRESULTs and Exceptions.