Would like to print the key of a dictionary in a message box.
Would like to print the value of a dictionary in a message box.
Would like to print the key of a dictionary in a message box.
Would like to print the value of a dictionary in a message box.
@Aishwarya_Maggi
Use for each activity. In properties, set Values as your dictionary and TypeArgument to System.Collections.Generic.KeyValuePair<TKey, TValue>
To display key, use item.Key and for value, item.Value properties
If this helps, please mark it as solution so that people facing similar issues can directly navigated to answer.
When trying to type argument of the for each loop I got the following error
Also I need to get the key of the dictionary for a specific index instead of looping through the dictionary.
HI @Aishwarya_Maggi,
You need to specify the Key and Value data types… Check the screenshot below…
Hi, thanks for your reply. I have managed to change the data type but I get an error when trying to print the key
Cool…
For the dictionary key issue, try looking into these two posts… These two gives a good idea on how to loop through the dictionaries…
Let know if it doesn’t help… if it works, please mark the answer as the solution so it will be helpful for others as well
Thanks
You have put the argument type to dictionary. it should be System.Collections.Generic.KeyValuePair<TKey, TValue>
@Aishwarya_Maggi
To get elements from specific index, Use,
dictTest.ElementAt(0).Key
dictTest.ElementAt(0).Value
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.