. NET expression evaluation: expression Evaluator

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.