using System.Collections.Generic;
using CodingSeb.ExpressionEvaluator;
public class XExpressionEvaluator : ExpressionEvaluator
protected override void Init()
operatorsDictionary.Add("and", ExpressionOperator.ConditionalAnd);
operatorsDictionary.Add("or", ExpressionOperator.ConditionalOr);
public static void Main()
ExpressionEvaluator evaluator = new XExpressionEvaluator();
evaluator.Variables = new Dictionary<string, object>()
List<string> expressions = new List<string>()
"1==2 or 2==1 ? 100 : 200",
"1==1 or 2==1 ? 100 : 200",
"1==2 and 2==1 ? 100 : 200",
"1==1 and 2==1 ? 100 : 200",
expressions.ForEach(expression =>
Console.WriteLine(expression);
Console.WriteLine(evaluator.Evaluate(expression));
catch (Exception exception)
Console.WriteLine(exception);
Console.WriteLine(string.Empty);