Table of Contents

Class MaxElementCountValidator<T, TResult>

Namespace
LfrlAnvil.Validation.Validators
Assembly
LfrlAnvil.Validation.dll

Represents a generic collection of objects validator that expects a maximum number of elements.

public sealed class MaxElementCountValidator<T, TResult> : IValidator<IReadOnlyCollection<T>, TResult>

Type Parameters

T

Element type.

TResult

Result type.

Inheritance
MaxElementCountValidator<T, TResult>
Implements
Inherited Members
Extension Methods

Constructors

MaxElementCountValidator(int, TResult)

Creates a new MaxElementCountValidator<T, TResult> instance.

public MaxElementCountValidator(int maxCount, TResult failureResult)

Parameters

maxCount int

Expected maximum number of elements.

failureResult TResult

Failure result.

Exceptions

ArgumentOutOfRangeException

When maxCount is less than 0.

Properties

FailureResult

Failure result.

public TResult FailureResult { get; }

Property Value

TResult

MaxCount

Expected maximum number of elements.

public int MaxCount { get; }

Property Value

int

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.