I'm working on a deserialization class in .NET, I have to develop a method that provides to me with a variable name that is stored in a string.
I have a string such as:
string string_name = "this_is_going_to_be_var_name";
Now what can I do so that my code dynamically declares a variable named this_is_going_to_be_var_name?
So to clear things up: There will be a deserialization class that will declare variables of the same names as strings provided as input with their PARENT TYPES as per wish of the Higher Level Programmer/User.
For Example: In javascript/jQuery, when I fetch JSON by making a request, the interpreter declares variable(s)/array(s) of the same name and assigns values to them. If {"var_name":"var_value"} is a JSON string, the interpreter will create a variable named var_name and will assign "var_value" to it such as json_data_object.var_name.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…