Class ForDefaultIfNullStructValidator<T, TResult>
- Namespace
- LfrlAnvil.Validation.Validators
- Assembly
- LfrlAnvil.Validation.dll
Represents a generic object validator which uses specified DefaultValue when validated object is null.
public sealed class ForDefaultIfNullStructValidator<T, TResult> : IValidator<T?, TResult> where T : struct
Type Parameters
TObject type.
TResultResult type.
- Inheritance
-
ForDefaultIfNullStructValidator<T, TResult>
- Implements
-
IValidator<T?, TResult>
- Inherited Members
- Extension Methods
Constructors
ForDefaultIfNullStructValidator(IValidator<T, TResult>, T)
Creates a new ForDefaultIfNullStructValidator<T, TResult> instance.
public ForDefaultIfNullStructValidator(IValidator<T, TResult> validator, T defaultValue)
Parameters
validatorIValidator<T, TResult>Underlying validator.
defaultValueTDefault value to use instead of a null object.
Properties
DefaultValue
Default value to use instead of a null object.
public T DefaultValue { get; }
Property Value
- T
Validator
Underlying validator.
public IValidator<T, TResult> Validator { get; }
Property Value
- IValidator<T, TResult>
Methods
Validate(T?)
Validates the provided obj.
[Pure]
public Chain<TResult> Validate(T? obj)
Parameters
objT?Object to validate.
Returns
- Chain<TResult>
Result of
objvalidation.