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
TElement type.
TResultResult 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
minCountintMinimum expected number of elements.
maxCountintMaximum expected number of elements.
failureResultTResultFailure result.
Exceptions
- ArgumentOutOfRangeException
When
minCountis 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
objIReadOnlyCollection<T>Object to validate.
Returns
- Chain<TResult>
Result of
objvalidation.