Table of Contents

Class MaxLengthValidator<TResult>

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

Represents a string validator that expects a maximum Length.

public sealed class MaxLengthValidator<TResult> : IValidator<string, TResult>

Type Parameters

TResult

Result type.

Inheritance
MaxLengthValidator<TResult>
Implements
IValidator<string, TResult>
Inherited Members
Extension Methods

Constructors

MaxLengthValidator(int, TResult)

Creates a new MaxLengthValidator<TResult> instance.

public MaxLengthValidator(int maxLength, TResult failureResult)

Parameters

maxLength int

Expected maximum Length.

failureResult TResult

Failure result.

Exceptions

ArgumentOutOfRangeException

When maxLength is less than 0.

Properties

FailureResult

Failure result.

public TResult FailureResult { get; }

Property Value

TResult

MaxLength

Expected maximum Length.

public int MaxLength { get; }

Property Value

int

Methods

Validate(string)

Validates the provided obj.

[Pure]
public Chain<TResult> Validate(string obj)

Parameters

obj string

Object to validate.

Returns

Chain<TResult>

Result of obj validation.