Hi,
I am trying to do something similar to this
Byte tmpvar;
string tmpvar2;
tmpvar2 = "textBox1.Text";
tmpvar = Convert.ToByte(tmpvar2); ;
Of course it does not accept tmpvar2 when calling Convert.ToByte() is there a way to have the contents of tmpvar2 interperted as as variable ?
I have seen the eval() command work on some scripting languages, is there something similar in C# ?
Cheers
Loading
JackPosted Dec 20, 2008, 3:04 AM
Dusan TkacPosted Dec 19, 2008, 10:08 AM
I think that you have two options:
- dynamic code generation
- reflection
None of these is as straightforward and simple as eval in scripting languages.
Start your research e.g. here : http://www.codeproject.com/KB/dotnet/Expr.aspx
Cheers,
Dusan