Difference - Dictionary("key") and Dictionary.item("key")

Hi, Using Uipath I’ve notice that we can assign Dictionary(“key”) and Dictionary.item(“key”) and both works the same way. (I’m using Dictionary(of String, Object))

What’s the difference using one or another? (with and without “.item”)

Dictionary(“Key”) - Only gets the value of a given key if exists in Dictionary.
Dictionary.Item(“Key”) - Gets the value of a given key if exists in Dictionary.
Dictionary.Item(“Key”,“Value”) - Sets the value of a given key if exists in Dictionary.

.Item - Gets or sets the element with the specified key in the Dictionary<TKey,TValue>.

Regards,
Karthik Byggari

1 Like