How to Calculate a string math expression RRS feed

  • Question

  • What I want is a method eg:

    object calc(string exp)

    It works like

    int a=5

    int b=6

    calc("a+b*a") //should return 35

    And this method also can calculate the bool value likes

    bool a=true

    bool b=false

    int c=5

    int d=4

    calc("a&&b||(c>d)") //should return true

    Wednesday, August 13, 2014 1:48 AM


All replies