Class StructValidatorExtensions
- Namespace
- LfrlAnvil.Validation.Extensions
- Assembly
- LfrlAnvil.Validation.dll
Contains IValidator<T, TResult> extension methods for value types.
public static class StructValidatorExtensions
- Inheritance
-
StructValidatorExtensions
- Inherited Members
Methods
ForDefaultIfNull<T, TResult>(IValidator<T, TResult>, T)
Creates a new ForDefaultIfNullStructValidator<T, TResult> instance.
[Pure]
public static IValidator<T?, TResult> ForDefaultIfNull<T, TResult>(this IValidator<T, TResult> validator, T defaultValue) where T : struct
Parameters
validator
IValidator<T, TResult>Underlying validator.
defaultValue
TDefault value to use instead of a null object.
Returns
- IValidator<T?, TResult>
New ForDefaultIfNullStructValidator<T, TResult> instance.
Type Parameters
T
Object type.
TResult
Result type.
ForNullable<T, TResult>(IValidator<T, TResult>)
Creates a new ForNullableStructValidator<T, TResult> instance.
[Pure]
public static IValidator<T?, TResult> ForNullable<T, TResult>(this IValidator<T, TResult> validator) where T : struct
Parameters
validator
IValidator<T, TResult>Underlying validator.
Returns
- IValidator<T?, TResult>
New ForNullableStructValidator<T, TResult> instance.
Type Parameters
T
Object type.
TResult
Result type.