public static ValidateTarget <TItem> In <TItem, TCollection>([ValidatedNotNull] this ValidateTarget <TItem> target, TCollection valueToCompare, Func <string> getErrorMessage = null) where TCollection : IEnumerable <TItem> { if (valueToCompare == null || !TypedCollectionProxy <TCollection, TItem> .Contains(valueToCompare, target.Value)) { ExceptionFactory.ThrowException(target.Traits.GenericFailureExceptionType, getErrorMessage != null ? getErrorMessage.Invoke() : ErrorMessageFactory.ShouldBeIn(target)); } return(target); }