public static bool ApplyBinaryOperator(IEnumerable <Operator> ops, BinaryOperatorType opType, object first, object second, out object success, out ParseException failure) { Validate.NonNull(ops, nameof(ops)); Validate.NonNull(opType, nameof(opType)); Validate.NonNull(first, nameof(first)); Validate.NonNull(second, nameof(second)); bool worked = ApplyBinaryOperators( FindBinaryOperators( ops, opType, first.GetType(), second.GetType() ), first, second, out success ); if (!worked) { failure = ParseException.BinaryOperatorEvaluationFailed(opType.GetSymbolString(), first.ToString(), second.ToString()); return(false); } else { failure = null; return(true); } }