Any() public method

public Any ( Lexer, yyl ) : System
yyl Lexer,
return java.lang.System
コード例 #1
0
        /// <summary>Determines whether the specified object is valid.</summary>
        /// <param name="validationContext">The validation context.</param>
        /// <returns>A collection that holds failed-validation information.</returns>
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (Any.Any() && All.Any() || !All.Any() && !Any.Any())
            {
                return(new []
                {
                    Any.Any() && All.Any() ?
                    new ValidationResult($"Both {nameof(Any)} and {nameof(All)} properties have items, which is invalid. One or the other must have items provided.") :
                    new ValidationResult($"Neither {nameof(Any)} and {nameof(All)} properties have items, which is invalid. One or the other must have items provided."),
                });
            }

            return(Enumerable.Empty <ValidationResult>());
        }