Dictionary values question

A developer initialized the following dictionary:

SampleDictionary = New Dictionary(Of String, String) From { {“HUB Academy”, “RPA”}, {“UiPath”, “Certificate”} }
How do we to return the value “Certificate” from this dictionary?

A.sampleDictionary(“UiPath”)
B.sampleDictionary.Keys(“UiPath”)
C.sampleDictionary(“UiPath”).GetValue
D.sampleDictionary.Values(2)

@Latifa

answer was option: A

Look above you will get it

Letter A sampleDictionary(“UiPath”)

Hi @Latifa

Yes, that’s A

So, if you see the Config file in the Re - Framework it is a dictionary type so it’s a Key-Value Pair

So in order to get the value you need to use SampleDictionary(Key) → This will results the Value

Hope this may help you

Thanks,
Srini

Hi @Latifa

To return the value “Certificate” from the dictionary, you would use the syntax of dictionary(key). So, SampleDictionary("UiPath") will give you the value “Certificate” because “UiPath” is the key that corresponds to that value in the dictionary.

This image will provide you better understanding.

Hope it helps!!

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