public static ValidateTarget <TSet> IsSubsetOf <TSet, TItem>([ValidatedNotNull] this ValidateTarget <TSet> target, IEnumerable <TItem> valueToCompare, Func <string> getErrorMessage = null) where TSet : ISet <TItem> { if (target.Value != null) { if (!target.Value.IsSubsetOf(valueToCompare)) { ExceptionFactory.ThrowException(target.Traits.GenericFailureExceptionType, getErrorMessage != null ? getErrorMessage.Invoke() : ErrorMessageFactory.ShouldBeSubsetOf(target)); } } return(target); }