 | ExceptionExtensionsFindT Method (Exception) |
Searches an exception for an underlying exception of a specific type specified as a generic
type parameter. 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 T Find<T>(
this Exception e
)
where T : Exception
<ExtensionAttribute>
Public Shared Function Find(Of T As Exception) (
e As Exception
) As T
public:
[ExtensionAttribute]
generic<typename T>
where T : Exception
static T Find(
Exception^ e
)
[<ExtensionAttribute>]
static member Find :
e : Exception -> 'T when 'T : Exception
Parameters
- e
- Type: SystemException
The exception being tested.
Type Parameters
- T
- The target exception type.
Return Value
Type:
TThe 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