共用方式為


ErrorHandler.ThrowOnFailure Method (Int32, array<Int32 )

Checks if the parameter is a success or failure HRESULT and throws an exception if it is a failure that is not included in the array of well-known failures.

Namespace:  Microsoft.VisualStudio
Assemblies:   Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
  Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)

Syntax

'宣告
Public Shared Function ThrowOnFailure ( _
    hr As Integer, _
    ParamArray expectedHRFailure As Integer() _
) As Integer
'用途
Dim hr As Integer
Dim expectedHRFailure As Integer()
Dim returnValue As Integer

returnValue = ErrorHandler.ThrowOnFailure(hr, _
    expectedHRFailure)
public static int ThrowOnFailure(
    int hr,
    params int[] expectedHRFailure
)
public:
static int ThrowOnFailure(
    int hr, 
    ... array<int>^ expectedHRFailure
)
static member ThrowOnFailure : 
        hr:int * 
        expectedHRFailure:int[] -> int 
public static function ThrowOnFailure(
    hr : int, 
    ... expectedHRFailure : int[]
) : int

Parameters

  • expectedHRFailure
    Type: array<System.Int32[]
    If hr is found in this array of expected failures no exception should be thrown.

Return Value

Type: System.Int32
The HRESULT.

.NET Framework Security

See Also

Reference

ErrorHandler Class

ErrorHandler Members

ThrowOnFailure Overload

Microsoft.VisualStudio Namespace

Other Resources

HRESULT Information in Managed Code