Click or drag to resize

ExceptionExtensionsContainsT Method

Determines whether the exception has a specified type or was triggered by an underlying exception of a specified 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
Syntax
public static bool Contains<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: Boolean
true if the exception was triggered by an exception of type T.

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