Comment on page
Validation
The validation methods Geralt uses can be called to avoid ugly if statement validation at the top of functions. This is handy for custom constructions.
Checks that an integer is equal to the valid size.
Validation.EqualToSize(string paramName, int size, int validSize)
size
is not equal to validSize
.Checks that an integer is between the minimum and maximum size.
Validation.SizeBetween(string paramName, int size, int minSize, int maxSize)
size
is less than minSize
or greater than maxSize
.Checks that an integer is not less than the minimum size.
Validation.NotLessThanMin(string paramName, int size, int minSize)
size
is less than minSize
.Checks that an integer is not greater than the maximum size.
Validation.NotGreaterThanMax(string paramName, int size, int maxSize)
size
is greater than maxSize
.Checks that the length of a span is not equal to zero.
Validation.NotEmpty(string paramName, int size)
size
is equal to 0.Checks that an integer is not less than or equal to zero.
Validation.GreaterThanZero(string paramName, int size)
size
is less than or equal to 0.Checks that an array is not null.
Validation.NotNull<T>(string paramName, T value)
value
is null.Checks that a string is not null or empty.
Validation.NotNullOrEmpty(string paramName, string value)
value
is null.value
has a length of 0.Last modified 2mo ago