public override PropertyConstraintViolationError Validate(object value, PropertyDefinition propertyDefinition, IPropertyBag propertyBag) { EnhancedTimeSpan t = (value is TimeSpan) ? ((TimeSpan)value) : ((EnhancedTimeSpan)value); if (EnhancedTimeSpan.Zero != t % this.unit) { return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationDontMatchUnit(this.unit.ToString(), t.ToString()), propertyDefinition, value, this)); } return(null); }