Example #1
0
 public static Pred <T> AnyTrue <T>(this IEnumerable <Pred <T> > predicates, bool shortCircuit = true)
 {
     if (predicates == null)
     {
         throw new ArgumentNullException(nameof(predicates));
     }
     return(Pred <T> .Any(predicates.Select(p => p.Func), shortCircuit));
 }
Example #2
0
 public static Func <T, bool> AnyTrue <T>(this IEnumerable <Func <T, bool> > predicates, bool shortCircuit = true)
 {
     if (predicates == null)
     {
         throw new ArgumentNullException(nameof(predicates));
     }
     return(Pred <T> .Any(predicates, shortCircuit));
 }
Example #3
0
 public static Predicate <T> Or <T>(this Predicate <T> predicate, Pred <T> other, bool shortCircuit = true)
 {
     if (predicate == null)
     {
         throw new ArgumentNullException(nameof(predicate));
     }
     if (other == null)
     {
         throw new ArgumentNullException(nameof(other));
     }
     return(new Pred <T>(x => predicate(x)).Or(other, shortCircuit));
 }
Example #4
0
        public static Func <T, bool> And <T>(this Func <T, bool> predicate, Pred <T> other, bool shortCircuit = true)
        {
            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            return(new Pred <T>(predicate).And(other, shortCircuit));
        }