public static bool HasDivideByZero(T data, Expression expression) { var visitor = new DivideByZeroChecker <T>(data); visitor.Visit(expression); return(visitor._hasDivideByZero); }
static int Calcul <T>(T data, Expression <Func <T, int> > query) { if (NegativeValueChecker <T> .HasNegative(data, query)) { return(0); } if (DivideByZeroChecker <T> .HasDivideByZero(data, query)) { return(-1); } return(query.Compile().Invoke(data)); }