 | ExceptionExtensionsFind Method (Exception, Type) |
Searches an exception for an underlying exception of a specific type. This is useful for
checking whether an exception has a specific inner exception or whether an
AggregateException
was triggered with a specific exception type.
Namespace:
System
Assembly:
Neon.Common (in Neon.Common.dll) Version: 2.14.0
Syntaxpublic static Exception Find(
this Exception e,
Type exceptionType
)
<ExtensionAttribute>
Public Shared Function Find (
e As Exception,
exceptionType As Type
) As Exception
public:
[ExtensionAttribute]
static Exception^ Find(
Exception^ e,
Type^ exceptionType
)
[<ExtensionAttribute>]
static member Find :
e : Exception *
exceptionType : Type -> Exception
Parameters
- e
- Type: SystemException
The exception being tested. - exceptionType
- Type: SystemType
The target exception type.
Return Value
Type:
ExceptionThe underlying exception or
null.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Exception. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also