Information.IsError(Object) Método
Definición
Devuelve un valor de tipo Boolean que indica si una expresión es un tipo de excepción.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
Parámetros
- Expression
- Object
Obligatorio.Required. Expresión Object.Object expression.
Devoluciones
Devuelve un valor de tipo Boolean que indica si una expresión es un tipo de excepción.Returns a Boolean value indicating whether an expression is an exception type.
Ejemplos
En el ejemplo siguiente se usa la IsError función para comprobar si una expresión representa una excepción del sistema.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
Comentarios
IsError Devuelve True si la expresión representa una Object variable que se deriva de la Exception clase en el System espacio de nombres.IsError returns True if the expression represents an Object variable that derives from the Exception class in the System namespace.
Una excepción que deriva de System.Exception se puede detectar con las Try...Catch...Finally instrucciones.An exception that derives from System.Exception can be caught with the Try...Catch...Finally statements.