Expression Evaluator is a lightweight, open-source free component that can parse C # expressions at run time. Expression evaluation should be used in many places, such as some wage or cost accounting system, you need to dynamically configure the calculation expression in the background, so as to calculate evaluation. Compared to NCal, this Expression Evaluator more powerful, although some functions overlap. It is also possible to calculate regular mathematical expressions.
The features supported by Expression Evaluator are:
Arithmetic operators supported, relational operators supported, and logical operators
Supports expression grouping and parentheses, and incrementing decrement operators
Support for expression property access and dynamic typing, support for string + operations
Supports suffix d/f/m/l/u/ul for numeric types,
Supports implicit expressions, and member access operators (.)
Supports some default types, such as double, float, char, string, DateTime, Convert, Math
Support for foreach Loops
。。。 Wait, more features also look forward to your use and discovery
A simple numeric expression does not show up, looking at a more innovative code:
Class myclass{public string[] myexternalstring; public int x;} var v = new MyClass (); v.myexternalstring = new string[] {"Hello", "There", "world!"}; v.x = 2;//key, register symbol Vregistry. Registersymbol ("V", v);//Dynamic calculation attribute//Return result is "there" because V.x=2,2/2=1, so return the value of index 1 "V.MYEXTERNALSTRING[V.X/2]"
Project home: http://www.open-open.com/lib/view/home/1435843266122
. NET expression evaluation: expression Evaluator