Table of Contents

ThrowIfFalse Method

Definition

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

ThrowIfFalse(bool, string, string, string)

Validates and throws an ArgumentException if the specified condition is false.

public static void ThrowIfFalse(bool condition, string paramName, string message = "Value is not in a valid state.", string expression = null)

Parameters

condition bool

The value to be evaluated.

paramName string

The name of the parameter that caused the exception.

message string

A message that describes the error.

expression string

The condition expressed as a string.

Exceptions

ArgumentException

condition is false.

ThrowIfFalse(Func<bool>, string, string, string)

Validates and throws an ArgumentException if the specified predicate returns false.

public static void ThrowIfFalse(Func<bool> predicate, string paramName, string message = "Value is not in a valid state.", string expression = null)

Parameters

predicate Func<bool>

The function delegate that determines if an ArgumentException is thrown.

paramName string

The name of the parameter that caused the exception.

message string

A message that describes the error.

expression string

The predicate expressed as a string.

Exceptions

ArgumentException

predicate returned false.