C#: Can a Dictionary<> or an ArrayList<> name be created from a variable string?


can a dictionary<> or arraylist<> name created variable string?

for example, i'm creating dictionary of ids needs contain either dictionary or arraylist object of same name, which can updated files associated id , whether owner of file (o) or user of file (u). needs this... i'm struggling in creating because embedded dictionary/arraylist has same name users , not specific them.

so needs this:

ids (dictionary key),  (value either dictionary/arraylist of same name)
     .add(userid1,                userid1)
                                              .add("file1", "o")
                                              .add("file2", "o")
                                              .add("file3", "u")              

     .add(userid2,                userid2)
                                              .add("file1", "u")
                                              .add("file2", "u")
                                              .add("file3", "o")

     .add(userid3,               userid3)
                                              .add("file1", "u")
                                              .add("file2", "u")
                                              .add("file3", "u")


sv

>>what need know whether or not can use string name in string variable name of new dictionary or arraylist instead of variable containing string name?

no, name of variable cannot be dynamic in c# if that's asking. language doesn't support this. the name of variable has to be known @ compile-time.

please remember mark helpful posts answer and/or helpful , please start new thread if have new question.



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'