Hi,
I want to create a dictionary (lets call it “dictionary1”) of type <String, Dictionary2>, with “Dictionary2” being also a dictionary, of type <Int32, HashSet>, with “HashSet” being a set of strings.
I successfully created all three variables and initialized each with the proper type.
I am able to fill the HashSet using the Invoke Method with the MethodName “Add”.
I am able to assign it to an entry of my Dictionary2 by simply doing an assignment using the Assign activity, as expected, this way:
dictionary2(1234) = myHashSet
Nevertheless, when I try to assign it to my dictionary1 the same way, that is,
dictionary1("whateverkey") = dictionary2
Studio complains with an error of the type “Cannot assign from type ‘System.Object’ to type ‘System.Collections.Generic.Dictionary2[System.Int32,System.Collections.Generic.HashSet
1[System.String]]’ in Assign activity ‘Assign’.” (btw, what a hassle to have to type this by hand because there’s no way to copy&paste the actual error from Studio)
I’ve tried to change the variable type of dictionary1 from Dictionary<String,Dictionary<Int32,HashSet>> to merely Dictionary<String,Object> (thinking of casting the dictionary element when later I want to use it or whatever), but it complains with exactly the same error.
To provide some proof of concept I’m attaching some screenshots.
The dictionary variables are properly initialized:
And this is where I’m doing the assignment:
No problem assigning the hashset to the dictionary: