mardi 14 juin 2016

Evaluate expression with Reflection in C#

I have to evaluate a expression whether the expression is true of false. I have

int Value1 = 123
int Value2 = 138

string Operators = "<=, >="
string LogicalOperator="OR"

My expression will be

Value1 <= Value2 OR Value1>=Value2

And for the above case, the expression will be:

123<=138 || 123>=138, which will be true

I want to implement a function which will take value1, value2, operators and logicalOperators and return a boolean value. But, it seems to difficult for me.





Aucun commentaire:

Enregistrer un commentaire