Function Add not working in List type variable

  1. I created List variable and added some default values in that
    new List(of string) from {“value1”, “value2”}
  2. When I used invoke method “Add” for that list I was not able to use that. I threw an error.


Could you please show me that error message and how you used that method.

try using

@blacksundar Instead of using add method use a activity called “Add To Collection”

Sorry it also didn’t work :frowning:


Method Name Should be Add

I used first “Add” only… then used this one. :-1


Check the workFlow

AddItemsToList.xaml (5.6 KB)

1 Like

Yes it is working, but if you can tell me what wrong I am doing ?

Is there any way to add item in list using Assign activity?

Hi @Vijay_Tulsalkar, I downloaded your file and it worked perfectly, but when I try to use the same logic (even copying and pasting) on my workflow it doesn’t work.

When I add new List(of String) from {"Cat", "Dog"}, the word String is underlined by red waves and an error message is shown saying ‘)’ expected.

I really don’t understand what is going on, if there some package missing or anything else.

I check the List type and it matches, I checked the configs and they also match…

I also tried to copy the whole content of the file to my sequence and again it fails and remove the Default value and replace by Unsupported Expression

Any idea what is going wrong?

I think I selected C# for my project and this is clearly a VB variable initialisation, please disregard my message :slight_smile: