Click or drag to resize

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
Syntax
public static T Find<T>(
	this Exception e
)
where T : Exception

Parameters

e
Type: SystemException
The exception being tested.

Type Parameters

T
The target exception type.

Return Value

Type: T
The 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