Class IsElementCountInRangeValidator<T, TResult>
- Namespace
- LfrlAnvil.Validation.Validators
- Assembly
- LfrlAnvil.Validation.dll
Represents a generic collection of objects validator that expects number of elements between a given range.
public sealed class IsElementCountInRangeValidator<T, TResult> : IValidator<IReadOnlyCollection<T>, TResult>
Type Parameters
T
Element type.
TResult
Result type.
- Inheritance
-
IsElementCountInRangeValidator<T, TResult>
- Implements
-
IValidator<IReadOnlyCollection<T>, TResult>
- Inherited Members
- Extension Methods
Constructors
IsElementCountInRangeValidator(int, int, TResult)
Creates a new IsElementCountInRangeValidator<T, TResult> instance.
public IsElementCountInRangeValidator(int minCount, int maxCount, TResult failureResult)
Parameters
minCount
intMinimum expected number of elements.
maxCount
intMaximum expected number of elements.
failureResult
TResultFailure result.
Exceptions
- ArgumentOutOfRangeException
When
minCount
is not in [0,maxCount
] range.
Properties
FailureResult
Failure result.
public TResult FailureResult { get; }
Property Value
- TResult
MaxCount
Maximum expected number of elements.
public int MaxCount { get; }
Property Value
MinCount
Minimum expected number of elements.
public int MinCount { get; }
Property Value
Methods
Validate(IReadOnlyCollection<T>)
Validates the provided obj
.
[Pure]
public Chain<TResult> Validate(IReadOnlyCollection<T> obj)
Parameters
obj
IReadOnlyCollection<T>Object to validate.
Returns
- Chain<TResult>
Result of
obj
validation.