IDictionary'2' does not have public instance method name'ADD'

Hi
i was converting one of process from windows legacy to windows i saw key exists in dictionary activity was throwing error i replaced that activity with Invoke Method i am getting this error can anyone please help me with this


Thank you

Hello @Farooq_Syeda

Can you try with this code inside an IF-sentence in stead:

If in_DictConfig.ContainsKey("keytolookfor")

Regards
Soren

Hi @SorenB ,
the thing is i should not modify anything inside the code as it was already existing process

Hey there,

Is it expected that one of them is a Dictionary (Of String…) and the other one is an IDictionary (Of String…)?

Seems like the one you are trying to Add, is a different kind of variable, might be worth checking by changing it to the one above :slight_smile:

image

BR,
Ignasi

Hello again

I have seen the same problem when converting some of my processes from Legacy to Windows.
Here we have simply replaced the check with a build in function as shown above.

If you are trying to check whether or not a key is present, and then creating it if not, then you could use:

If Not in_DictConfig.ContainsKey("keytolookfor")
Then Assign in_DictConfig("key") = "Value"

Regards
Soren

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