Information.IsError(Object) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- Expression
- Object
Required. Object
expression.
Returns a Boolean
value indicating whether an expression is an exception type.
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
IsError
returns True
if the expression represents an Object
variable that derives from the Exception class in the System namespace.
An exception that derives from System.Exception can be caught with the Try...Catch...Finally
statements.
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: