public override PropertyConstraintViolationError Validate(object value, PropertyDefinition propertyDefinition, IPropertyBag propertyBag) { byte[] array = (byte[])value; if (array != null) { if (array.Length < this.minLength) { return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationByteArrayLengthTooShort(this.minLength, array.Length), propertyDefinition, value, this)); } if (this.maxLength != 0 && array.Length > this.maxLength) { return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationByteArrayLengthTooLong(this.maxLength, array.Length), propertyDefinition, value, this)); } } return(null); }