2
Answers

using the contens of a variable as a variable name

Jack

Jack

16y
4.5k
1
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

Answers (2)