public EvaluatorResult Evaluate(IInterpreterContext context, string expression) { string LeftValue; try { if (checkForExistence) { var res = context.PropertyExists(leftSide); // just check existence, nothing else, or it does not exist if (res == false || NoRightSide) { if (IsNegate) { res = !res; } return(new EvaluatorResult(res, string.Empty)); } } // existence of property is assumed (it is either checked or no "?" was present if (evaluator is Evaluator.ExpressionEvaluator) { LeftValue = context.EvaluateProperty(leftSide); } else { var evalRes = evaluator.Evaluate(context, leftSide); if (evalRes.Result == EvaluationResultValues.True) { LeftValue = evalRes.Value; } else { LeftValue = "error"; } } } catch (Exception ex) { return(new EvaluatorResult(ex)); } LeftValue = LeftValue.ToLower(); bool retVal; if (CompareEqual) { retVal = LeftValue == rightSide; } else { retVal = LeftValue != rightSide; } // leading "!" is valid for the complete if-clause if (IsNegate) { retVal = !retVal; } return(new EvaluatorResult(retVal, string.Empty)); }