Table of Contents

Class MinElementCountValidator<T, TResult>

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

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

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

Type Parameters

T

Element type.

TResult

Result type.

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

Constructors

MinElementCountValidator(int, TResult)

Creates a new MinElementCountValidator<T, TResult> instance.

public MinElementCountValidator(int minCount, TResult failureResult)

Parameters

minCount int

Expected minimum number of elements.

failureResult TResult

Failure result.

Exceptions

ArgumentOutOfRangeException

When minCount is less than 0.

Properties

FailureResult

Failure result.

public TResult FailureResult { get; }

Property Value

TResult

MinCount

Expected minimum number of elements.

public int MinCount { 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.