I am trying to create a List of Dictionary
items. I am not sure how to add items in list and how to get back the values while traversing the list.
I think this is what you are looking for?
{
MyList.Add(new Dictionary());
MyList.Add(new Dictionary());
MyList[0].Add("Dictionary 1", 1);
MyList[0].Add("Dictionary 1", 2);
MyList[0].Add("Dictionary 2", 3);
MyList[0].Add("Dictionary 2", 4);
foreach (var dictionary in MyList)
foreach (var keyValue in dictionary)
Console.WriteLine(string.Format("{0} {1}", keyValue.Key, keyValue.Value));
}