public bool IsValid(object value, IConstraintValidatorContext constraintValidatorContext) { ISpecified obj = value as ISpecified; if (obj != null) { return(obj.IsSpecified); } return(false); }
public static bool IsValidAndSpecified(this object source, params ValidationTag[] tags) { if (!source.IsValid(tags)) { return(false); } ISpecified specified = source as ISpecified; return(specified?.IsSpecified ?? false); }