Table of Contents

Class RefValidatorExtensions

Namespace
LfrlAnvil.Validation.Extensions
Assembly
LfrlAnvil.Validation.dll

Contains IValidator<T, TResult> extension methods for reference types.

public static class RefValidatorExtensions
Inheritance
RefValidatorExtensions
Inherited Members

Methods

ForDefaultIfNull<T, TResult>(IValidator<T, TResult>, T)

[Pure]
public static IValidator<T?, TResult> ForDefaultIfNull<T, TResult>(this IValidator<T, TResult> validator, T defaultValue) where T : class

Parameters

validator IValidator<T, TResult>

Underlying validator.

defaultValue T

Default value to use instead of a null object.

Returns

IValidator<T, TResult>

New ForDefaultIfNullRefValidator<T, TResult> instance.

Type Parameters

T

Object type.

TResult

Result type.

ForNullable<T, TResult>(IValidator<T, TResult>)

Creates a new ForNullableRefValidator<T, TResult> instance.

[Pure]
public static IValidator<T?, TResult> ForNullable<T, TResult>(this IValidator<T, TResult> validator) where T : class

Parameters

validator IValidator<T, TResult>

Underlying validator.

Returns

IValidator<T, TResult>

New ForNullableRefValidator<T, TResult> instance.

Type Parameters

T

Object type.

TResult

Result type.