Reputation: 3
I want to create an array of Dictionaries. But the array size is unknown. For integer, i used List to obtain the integer array of unknown size. But in the case of Dictionary, am not able to create a list of Dictionary. Is thr any wayz by which this can be done? Dictionary(int, String) paramList=null;
I am want to create the array of paramList(above). I am using C Sharp.
Upvotes: 0
Views: 1807
Reputation: 285047
List<Dictionary<int, String>> paramList = new List<Dictionary<int, String>>();
However, this is usually not the right data structure. More likely, you just need a single dictionary.
Dictionary<int, String> paramList = new Dictionary<int, String>();
paramList[1] = "foo";
paramList[2] = "bar";
Upvotes: 4