I would like to dynamically create a list.
Currently I have the user entering a name that they want. Then I would like the name that they have submitted to be the name of the list.
For example:
The user entered "Collection1", then I would like to create a list dynamically on another script like the following:
List<int> Collection1 = new List<int>();
Currently I'm stuck on how to do this, is there a way to create the list or rename the list for example from tempList to Collection1?
Abit of background, so currently im trying to create a card game. Where users are able to put the selected cards into a deck. I would like to give the user an option to name the decks. So in order to differentiate between multiple decks (which i use list to complete), i need to have a different name for the list. Preferably i would like to let the users insert the name of the deck. So in this case, i would need to be able to rename/change/ create a list that is based on their inserted deck name. So if the user wants to name their deck as collection1, i would like to have the list named as collection1List.
There is also a possibility that the user (as in the player) will create more than one deck of cards. So it will not be suitable to create a predefined list.
Dictionary<string, List<int>>so you can adress different lists via string key names?