This documentation is slowly being reviewed, so you may see some inconsistencies between sections.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Validation

Purpose

The validation methods that Geralt uses can be called to avoid ugly if statement validation at the top of functions. This is handy for custom constructions.

Usage

EqualTo

Checks that an integer is equal to a required value.

Validation.EqualTo<T>(string paramName, T value, T required) where T : IBinaryInteger<T>

Exceptions

ArgumentOutOfRangeException

value must be equal to required.

Between

Checks that an integer is between a minimum and maximum value (exclusive).

Validation.Between<T>(string paramName, T value, T min, T max) where T : IBinaryInteger<T>

Exceptions

ArgumentOutOfRangeException

value must be between min and max (exclusive).

BetweenOrEqualTo

Checks that an integer is between a minimum and maximum value (inclusive).

Exceptions

ArgumentOutOfRangeException

value must be between min and max (inclusive).

GreaterThan

Checks that an integer is greater than a minimum value.

Exceptions

ArgumentOutOfRangeException

value must be greater than min.

GreaterThanOrEqualTo

Checks that an integer is greater than or equal to a minimum value.

Exceptions

ArgumentOutOfRangeException

value must be greater than or equal to min.

LessThan

Checks that an integer is less than a maximum value.

Exceptions

ArgumentOutOfRangeException

value must be less than max.

LessThanOrEqualTo

Checks that an integer is less than or equal to a maximum value.

Exceptions

ArgumentOutOfRangeException

value must be less than or equal to max.

MultipleOf

Checks that an integer is a multiple of another integer.

Exceptions

ArgumentOutOfRangeException

value must be a multiple of multipleOf (and not less than or equal to 0).

NotEmpty

Checks that an integer (e.g., the length of a span) is not equal to zero.

Exceptions

ArgumentOutOfRangeException

size must not be equal to 0.

NotNull

Checks that a parameter is not null.

Exceptions

ArgumentNullException

value must not be null.

NotNullOrEmpty

Checks that an enumerable (e.g., array) is not null or empty.

Exceptions

ArgumentNullException

enumerable must not be null.

ArgumentOutOfRangeException

enumerable must not be empty.

HasNoNullValues

Checks that an enumerable (e.g., array) is not null and has no null values.

Exceptions

ArgumentNullException

enumerable must not be null.

ArgumentException

enumerable must not contain any null values.

HasNoNullOrEmptyValues

Checks that an enumerable (e.g., string array) is not null/empty and has no null/empty values.

Exceptions

ArgumentNullException

enumerable must not be null.

ArgumentOutOfRangeException

enumerable must not be empty.

ArgumentException

enumerable must not contain any null or empty values.

HasNoNullValues

Checks that a jagged enumerable (e.g., jagged array) is not null and has no null values.

Exceptions

ArgumentNullException

jaggedEnumerable must not be null.

ArgumentException

jaggedEnumerable must not contain any null collections/values.

HasNoNullOrEmptyValues

Checks that a jagged enumerable (e.g., jagged string array) is not null/empty and has no null/empty values.

Exceptions

ArgumentNullException

jaggedEnumerable must not be null.

ArgumentOutOfRangeException

jaggedEnumerable must not be empty.

ArgumentException

jaggedEnumerable must not contain any null or empty collections/values.

Last updated