What is a Dictionary?
In general, a Dictionary is a collection of words and their Meanings/Definitions.
In the same Dictionary in any programming language is a collection of Keys and Values, where “Key” is equivalent to Words and “Value” is equivalent to Meanings/Definitions.
Dictionary<TKey, TValue> is a generic collection class available in the System.Collection.Generics namespace. Here “TKey” denotes the type of key and “TValue” is the type of TValue.
Implementation using UiPath :
Let us implement a workflow to achieve the below functionalities
Major Steps That We Will Implement:
1. Defining a Dictionary
2. Adding items to the Dictionary
3. Accessing items from the Dictionary
Drag “Assign” activity into the designer panel and define the dictionary.
my_Dictionary = new Dictionary(Of String, String)
Here my_Dictionary is of System.Collection.Generics.Dictionary<String, String> type
Drag “Invoke Method” activity into the designer panel to add items to the Dictionary.
Value: New Delhi
Another way of adding items Dictionary is by using Microsoft.Activities.Extensions package.
Drag “Add to dictionary” activity into the designer panel to add items to the Dictionary.
Value: Washington, D.C
Drag “Message Box” activity to display the first added Key and Value pair
i.e. Find the Value of the Key “INDIA”
Drag “Message Box” activity to display the second added Key and Value pair.
i.e. Find the Value of the Key “USA”
Finally, execute the workflow 🙂
Click here to download the Source Code…
Hope it has helped you…