0
Ho to create Dynamic int variable name from string.
Create dynamic int variable name from string Suppose i have a string string name= dynamic; I want to create an integer variable name with that string. Eg:- int dynamic= 1; This can be achieved using Dictionary in C# but i dont know how
1 Odpowiedź
+ 1
Variables are defined at compile time so you can't create at run time.
but you may expecting like this by dictionary
string name ="dinamic";
Dictionary<string,int> d = new Dictionary<string,int>();
d.Add(name,1); //"dinamic" as key
hope it helps....