Information.IsError(Object) Metoda
Definice
Vrací Boolean hodnotu určující, zda je výraz typem výjimky.Returns a Boolean value indicating whether an expression is an exception type.
public:
static bool IsError(System::Object ^ Expression);
public static bool IsError (object? Expression);
public static bool IsError (object Expression);
static member IsError : obj -> bool
Public Function IsError (Expression As Object) As Boolean
Parametry
- Expression
- Object
Povinná hodnota.Required. Object vyjádření.Object expression.
Návraty
Vrací Boolean hodnotu určující, zda je výraz typem výjimky.Returns a Boolean value indicating whether an expression is an exception type.
Příklady
Následující příklad používá IsError funkci ke kontrole, zda výraz představuje výjimku systému.The following example uses the IsError function to check if an expression represents a system exception.
Sub demonstrateIsError(ByVal firstArg As Integer)
Dim returnVal As New Object
Dim badArg As String = "Bad argument value"
Dim errorCheck As Boolean
If firstArg > 10000 Then
returnVal = New System.ArgumentOutOfRangeException(badArg)
End If
errorCheck = IsError(returnVal)
End Sub
Poznámky
IsError Vrátí True , zda výraz představuje Object proměnnou, která je odvozena od Exception třídy v System oboru názvů.IsError returns True if the expression represents an Object variable that derives from the Exception class in the System namespace.
Výjimka, která je odvozena z System.Exception , může být zachycena s Try...Catch...Finally příkazy.An exception that derives from System.Exception can be caught with the Try...Catch...Finally statements.