Dictionary in the Array

I am using dictionaries with in the array. It is giving me an error. I am not finding out the correct syntax of it. Can anyone guide me on this.

thank you

What error is generated?
Maybe this will help you:

I am using dictionary in the Array.
The thing you mentioned here I already know that.

What is the error given?

Its a syntax error. Saying that compile error } is expected.

it looks like in general you want to work with a dictionary of datatype: Int32, String

this can be initialized as below:

About the the usage of array maybe you can elaborate more on the scenario and what to achieve. Thanks

This is just the dictionary initialization.
Now create an array, in that array select dictionary with int32 and string. Dictionary2 , this will gonna appear. then give values to it. I am giving values but it is giving me compile time error of wrong syntax.
I hope you can understand now.

not sure If I got you in all. It looks like you are searching on how to initialize an array of dictionaries. Maybe following can help:

Yes I am looking for this.

How can we traverse the dictionaries in these arrays?
First loop is for array and then in its dictionary but it is not giving that result.

have a look on the typeArguments from the For each Activity setting and change it to the corresponding datatype

1 Like

Good try… the array “ArrayandDict” has 2 items of type Dictionary (of int32 , string) but both are null at the moment… let me do it

New Dictionary(Of Int32, String)(2) {} // declared array of length 0 to 2 that means it has 3 items
using assign activity all the dict0, dict1, dict2 are assigned to ArrayandDict items

First Foreach for the itration of array …see TypeArgument its Dictionary(of int32, string)
so each item will be a dictionary

inner loop to get value of each dictionary here the typeArgument is int32 because dictionary key is int32 it goes into key variable
Convert.ToString(item(key)) /// …

I have also created list of list but stuck in giving values to it.
Any one have the idea.
Others are syntax error which I am trying to resolve.

I have initialized different variables but while giving values I got the error.

Here we will first give the values to the list and then use add to collection function to append that list in the first list.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.