Dynamic variable in C#?

前端 未结 5 662
猫巷女王i
猫巷女王i 2020-11-30 12:00

Is it possible to use a dynamic variable (not sure about naming) in C#?

In PHP, I can do

$var_1 = \"2\";
$var_2 = \"this is variable 2\";

$test = ${         


        
5条回答
  •  一生所求
    2020-11-30 12:16

    If your var is a class field, then you can use the static GetField method from class Type to obtain field information, such as its current value.

提交回复
热议问题