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: 2.1.0.1
Syntax
public static void ThrowIf<T>(
	this Exception exception,
	Func<T, bool> predicate,
	T parameter
)

Parameters

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

Type Parameters

T
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