How to check if dictionary contain String

I have a dictionary whit key (email address) and value (number email send)

I need to check if email already exists in the dictionary

can Somebody help me?


Try to use: dictionary.Contains(String).

It will return a True/False value.


"impossible cinvert the value “UiPathCore.GenericValue” in “System.Collection.GenericsKeyValuePair(of String, integer)”




@dnllorenzetti there is also a Microsoft.Activities.Extension package available for UiPath that has some useful activities for the Dictionary data type. If you had that installed you could use the Key exists in dictionary activity.


Or just use “Values exists in dictionary” and “Keys exists in dictionary” Activities :smiley:

While they’re useful (especially AddToDictionary, since it’s void), for Exists it’s IMHO more efficient to use the method call.
Compare the 2:
bool keyExists = KeyExistsInDictionary(dictionary, value) if (keyExists) {...}


if (dictionary.Keys.Contains(value) {...}

It saves you space on the designer and an extra variable. While it doesn’t sound like much, in more complicated workflows it adds up. It’s still personal/team preference though.

I need to build something that for each key (email) counts how many times a message has been sent.

What do you recommend?