Dictionary (String, List) append

Dict(“key”) = “value”
Does this replace any existing value in the dictionary?
My scenario is i have a Dictionary(String, List(String)), if my key already exists in the Dictionary i need to append my new data in the List. Can someone Help. ?

if your key and value are string, then using the above format
Dict(“key”) = “value”, will replace the existing value for the key

To add the value to dictionary of specified key, use the following way

since value is list, to add values to list u can use add to collection property by specifying list as Dict(“key”)

Hope it helps you

Nived N
Happy Automation

Hi Nived, thanks for your reply.
I am trying the Add to Collection. But i get an error though i am giving both the Collection as Dict(“key”)


there is a mismatch of data type between List(Of String) and ICollection(List(Of String)). You have to use the same data type to add elements to a dictionary.

Regards, Gio

Yes, thanks, but i could not figure it out.

  1. Collection - as DictVariable(“Key”)
  2. TypeArgument - given as List(of string) … but this one is taken as icollection(list of(string)).
    if am not getting through this, i plan to take the value out from the dictionary and append the required values (merging the list using enumerable.concat) and send back to Dictionary and it will replace the existing one.

Sorry frns, what is the error in this.