Adf.Base.Validation.RegexAttribute.IsValid C# (CSharp) Method

IsValid() private method

private IsValid ( PropertyInfo propertyToValidate, object value ) : ValidationResult
propertyToValidate System.Reflection.PropertyInfo
value object
return ValidationResult
        public ValidationResult IsValid(PropertyInfo propertyToValidate, object value)
        {
            if (value == null)
            //                return ValidationResult.CreateError(property, "Adf.Business.AttributeRegexNull", property.Name);
                // this is not a NonEmpty attribute!
                return ValidationResult.Success;

            if (!Regex.IsMatch(value.ToString(), expression))
                return ValidationResult.CreateError(propertyToValidate, "Adf.Business.AttributeRegexInvalid", propertyToValidate.Name);

            return ValidationResult.Success;
        }