Click or drag to resize

ExceptionExtensionsThrowIfT Method

Throws the specified exception if the predicate results in a true value based on the parameter supplied

Namespace:  TestHelperExtensions
Assembly:  CBI.TestHelperExtensions (in CBI.TestHelperExtensions.dll) Version:
public static void ThrowIf<T>(
	this Exception exception,
	Func<T, bool> predicate,
	T parameter


Type: SystemException
The exception to be thrown (conditionally)
Type: SystemFuncT, Boolean
A function returning a bool containing functionality to determine if the exception should be thrown or not
Type: T
The parameter value used in the predicate function

Type Parameters

The data type of the parameter

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