I am getting error when using .key and .value in message box to output the dictionary


dictionary name is winnerlist of type(string,int32)

1 Like

Hi @VIKAS_PANDEY282

I hope you are using for each to loop through the dictionary and winner is the current item through which u are iterating

If yes , can u let me know what is the argument type of for each u had provided

1 Like

Yes you are correct ,
Argument for each loop is dictionary <string ,int32>

1 Like

Hi @VIKAS_PANDEY282,

Try setting argument type of your for each to System.Collections.Generic.KeyValuePair<String,Int32>

Kindly mark this answer as solution if it was useful.

Thanks!

Hello,

Its already that kind of argument .

1 Like

Hello @VIKAS_PANDEY282 ,

According to your print, the argument type seems to be System.Collections.Generic.Dictionary instead of System.Collections.Generic. KeyValuePair<String,Int32>

Would you mind sharing a print of the for each activity settings?

2 Likes

This solved my problem but if i may ask what is the difference between two .

2 Likes

Sure my friend, @VIKAS_PANDEY282

The difference is that when you are working with For each activity, the argument type must be the same as the type of the item that is inside your Array, List, Dictionary, Collection or whatever you are iterating.

So If you have Array of String, you need to set argument type to String.

If you have List of Int32, you need to set argument type to Int32.

In the case of Dictionary, the item that is inside of it is a KeyValuePar. In your case, KeyValuePar<String,Int32>

If you set argument type as Dictionary, the for each activity will understand that the item is another dictionary inside the dictionary that you are iterating

Got it?

Kindly mark the answer that helped you as solution.

Thanks!

1 Like

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