Search code examples
vb.netlistdictionarymultidimensional-arraywebmethod

List of Dictionary Arrays


Hit a wall, and can't find much in docs.

I have two dictionaries, and I'd like to put them in a list.

Dim listOfDictionaries As List(Of Dictionary(Of String, String))

is not working.

Am I correct in assuming that once I get this dimmed, I can .add the conventional way?

Details (EDIT)

When trying to listOfDictionaries.Add(dictionaryIWantToAdd), I get "value of type '1-dimensional array system.collection.generic.dictionary(of string, string)' cannot be converted to 'system.collection.generic.dictionary(of string, string)'

Solution

Helps to put the () on the end an array. :P


Solution

  • The conventional way is:

    Dim both = New List(Of Dictionary(Of String, String))()
    both.Add(Dictionary1)
    both.Add(Dictionary2)