I am trying to created nested dictionary variable like the below, But I get compile error stating that it needs “}” at line where I am adding items (line #2) to my nested dictionary.
What Am I missing here? Thanks.
Dim myNestedDictionary As Dictionary(Of String, Dictionary(Of String, Integer)) = New Dictionary(Of String, Dictionary(Of String, Integer))()
myNestedDictionary.Add("A", New Dictionary("A", 4)())
In VS 2008 and .net 3.5 you cannot declare and initialize a Dictionary in one line, so you have to do:
To retrieve the an item use the following:
The value in
lValueForAshould be 4.