I have a programs with thousands of variables. I need to perform complex operations on each of these variables that involves other variables.
What I would like to do is create a two column spreadsheet containing each of the variable names and the formula (stored as a string) used to calculate that variable's value. For each variable in the C# program, I would look up the string containing the formula and then calculate that formula.
Simple example:
Let's assume that there are three variables: x, y, and z.
x = 10
y = 20
I look up the formula for z and it returns the following string:
string = "x + y"
I am looking for a function that would do the equivalent of:
z = eval(string)
with the result that z would equal 30.
How can I do this in C#?
Many thanks in advance for any help.