Validation

Purpose

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

Usage

EqualToSize

Checks that an integer is equal to the valid size.

Validation.EqualToSize(string paramName, int size, int validSize)

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

size is not equal to validSize.

SizeBetween

Checks that an integer is between the minimum and maximum size.

Validation.SizeBetween(string paramName, int size, int minSize, int maxSize)

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

size is less than minSize or greater than maxSize.

NotLessThanMin

Checks that an integer is not less than the minimum size.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

size is less than minSize.

NotGreaterThanMax

Checks that an integer is not greater than the maximum size.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

size is greater than maxSize.

MultipleOfSize

Checks that an integer is a multiple of another integer.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

size is less than or equal to zero or not a multiple of multipleOf.

NotEmpty

Checks that the length of a span is not equal to zero.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

size is equal to 0.

GreaterThanZero

Checks that an integer is not less than or equal to zero.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

size is less than or equal to 0.

NotNull

Checks that an array is not null.

Exceptions

ArgumentNullExceptionarrow-up-right

value is null.

NotNullOrEmpty

Checks that a string is not null or empty.

Exceptions

ArgumentNullExceptionarrow-up-right

value is null.

ArgumentOutOfRangeExceptionarrow-up-right

value has a length of 0.

Last updated