Adding itemS to a list

Hi all. Just a quick one: how do I add more than 1 item to a list (variable) at once without any loops?
Add to collection allows only 1 item…is there any other option?

Thanks all! Much appreciated.

Hi @Ben_Huba ,

Maybe you require to use the below Expression :

YourList = YourList.Concat({"Item1","item2","item3"}).ToList

Hi @Ben_Huba - Did you try this way

ListVar = New List(Of String) From {"First", "Second", "Third"}

  • ListVar of type System.Collections.Generic.List<System.String>

Hi @Ben_Huba

“Add to Collection” activity allows you to add only one item at a time, you can use it multiple times in a sequence to add multiple items to the list. You can configure the “Add to Collection” activity multiple times, providing different values for the “Item” property each time, to add multiple items to the list.

Thanks. The list variable already exists and I already have some items in it. New List (of…) would create a new list. Much appreciated though. :slight_smile:

Thank you. That made the trick! Much appreciated!

1 Like

Thank you!

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