Table of Contents

CheckParameter Method

Definition

Namespace
Cuemon
Assemblies
Cuemon.Kernel.dll
Source
src/Cuemon.Kernel/Validator.cs

CheckParameter<T>(T, Action)

Provides a convenient way to verify a desired state from the provided validator while returning the specified argument unaltered.

public static T CheckParameter<T>(T argument, Action validator)

Parameters

argument T

The value to be evaluated.

validator Action

The delegate that must throw an Exception if the specified argument is not valid.

Returns

T

The specified argument unaltered.

Type Parameters

T

The type of the object to evaluate.

Remarks

Typically used when nesting calls from a constructor perspective.

Exceptions

ArgumentException

validator cannot be null.

CheckParameter<TResult>(Func<TResult>)

Provides a convenient way to verify a desired state from the provided validator while returning a result that reflects this.

public static TResult CheckParameter<TResult>(Func<TResult> validator)

Parameters

validator Func<TResult>

The function delegate that must throw an Exception if a desired state for TResult cannot be achieved.

Returns

TResult

The result of function delegate validator.

Type Parameters

TResult

The type of the object to return.

Remarks

Typically used when nesting calls from a constructor perspective.

Exceptions

ArgumentException

validator cannot be null.