Define mathematical expressions at run-time

johnix

New member
Joined
Oct 30, 2014
Messages
4
Programming Experience
3-5
Hi,
i need to implement a feature in my program to enable users to defining mathematical expressions.
Suppose we have this class
C#:
    public class test3
    {

        public float x = 2;
        public float y = 3;
        public float z = 0;
        public float w = 0;

        public double MyEquation()
        {
            return 0.0F;
        }

    }

i need to read an external file (txt or xml) that contain string equation, for example (x * x + 0.14 + y)
and replace at run-time the return value of method 'MyEquation' with the new equation

C#:
        public double MyEquation()
        {
            return (x * x + 0.14 + y) ;
        }


available fields are many (x, y, z, w, k, n, m, j, etc ..) and I can not know how many and what fields the user will use in its expression
there is a way to do this?
 
Back
Top Bottom