Home > Net >  Declarations of variables and dynamic assignment
Declarations of variables and dynamic assignment

Time:10-06

This is how we normally for declaring variables and assignment:
String A1="A1";
String A2="A2";
String A3="A3";
Such A1 to A3 variables can be called the

But the dynamic declare variables and what is the assignment?
Search the information said may use List List=new List (a);
So I declare variables so
for (int i=1; i <4. I++)
{
List. The Add (" A "+ i.T oString ());
}
But this is just declaring variables, but as a variable assignment how to assign? The lowercase a1, a2, a3 this value
I know maybe I this line of thinking is wrong, but as a small white only thought of this
My ultimate goal is to dynamically create a form control, dynamic access to the user to fill in the contents of the form controls, then write to the database
Dynamically create a form control is implemented, but further but I do not know how to do

CodePudding user response:

Don't want to use the Dictionary?

CodePudding user response:

List List=new List (a);
This is to declare a collection of string

for (int i=1; i <4. I++)
{
List. The Add (" a "+ i.T oString ()); This is to add members, call the list [0] value is a1, with collection wouldn't need the variable name
}

CodePudding user response:

Do you use Dynamic and new ExpandoObject () these two can meet,
  • Related