Share Link
Copied to clipboard
Embed on Your Page
Copied to clipboard
We Stand with Ukraine
Examples of ExpressionEvaluator that redefine existing operators by Coding Seb
true and true
True

true and false
False

false and true
False

false and false
False

true && true
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Operator '&' cannot be applied to operands of type 'bool' and 'CodingSeb.ExpressionEvaluator.ExpressionOperator'
   at CallSite.Target(Closure , CallSite , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.<>c.<.cctor>b__268_27(Object left, Object right)
   at CallSite.Target(Closure , CallSite , Func`3 , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at CallSite.Target(Closure , CallSite , Func`3 , Object , Object )
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.<>c__DisplayClass249_0.<ProcessStack>b__1(IDictionary`2 operatorEvalutationsDict)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.ProcessStack(Stack`1 stack)
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.Evaluate(String expression)
   at Program.<>c__DisplayClass2.<Main>b__1(String expression) in c:\Windows\Temp\h235gbqi.0.cs:line 47

true or true
True

true or false
True

false or true
True

false or false
False

true || true
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Operator '|' cannot be applied to operands of type 'bool' and 'CodingSeb.ExpressionEvaluator.ExpressionOperator'
   at CallSite.Target(Closure , CallSite , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.<>c.<.cctor>b__268_29(Object left, Object right)
   at CallSite.Target(Closure , CallSite , Func`3 , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at CallSite.Target(Closure , CallSite , Func`3 , Object , Object )
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.<>c__DisplayClass249_0.<ProcessStack>b__1(IDictionary`2 operatorEvalutationsDict)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.ProcessStack(Stack`1 stack)
   at CodingSeb.ExpressionEvaluator.ExpressionEvaluator.Evaluate(String expression)
   at Program.<>c__DisplayClass2.<Main>b__1(String expression) in c:\Windows\Temp\h235gbqi.0.cs:line 47
Cached Result
Last Run: 4:12:00 pm
Compile: 0.23s
Execute: 0.565s
Memory: 4.01Mb
CPU: 0.641s