src/GenFx/Validation/PropertyValidatorExtensions.cs
/// <summary>
/// Checks whether the property is valid.
/// </summary>
/// <param name="validator"><see cref="PropertyValidator"/> to perform the validation.</param>
/// <param name="propertyName">Name of the property being validated.</param>
/// <param name="value">Property value to check.</param>
/// <param name="owner">The object that owns the property being validated.</param>
Checks whether the property is valid.
Checks whether the property is valid .
public static void EnsureIsValid(this PropertyValidator validator, string propertyName, object? value, object owner)
        {
            if (validator == null)
            {
                throw new ArgumentNullException(nameof(validator));
            }
            string? errorMessage;
            if (!validator.IsValid(value, propertyName, owner, out errorMessage))
            {
                throw new ValidationException(errorMessage!);
            }
        }
public static void EnsureIsValid ( this PropertyValidator validator , string propertyName , object ? value , object owner ) { if ( validator == null ) { throw new ArgumentNullException ( nameof ( validator ) ) ; } string ? errorMessage ; if ( ! validator . IsValid ( value , propertyName , owner , out errorMessage ) ) { throw new ValidationException ( errorMessage ! ) ; } }
Checks whether the property is valid.
Checks whether the property is valid .
PropertyValidator
this
propertyName
string
Name of the property being validated.
Name of the property being validated .
value
object?
Property value to check.
Property value to check .
owner
object
The object that owns the property being validated.
The object that owns the property being validated .
validator
to perform the validation.
to perform the validation .