Can't append to collection of type ICollection<String>

I am using the Append to Collection activity, and I get this error compiling error:

image

This is my collection variable that I am trying to append to:

This is the Item I am trying to append to the collection:

And this is the activity
image

It seems like the output result allows only List variable. Do I need to convert from ICollection to List? Or what should I do?

Ensure that AttachmentList is of datatype: List(Of String)

1 Like

Hi @tarau_bianca,

Hope this post will help you

try with system.collections.generic.List<system.string> Variable

Thanks,
Rajkumar

Well then it won’t be the same thing as using the “Append to List” activity? What is the difference between this two then, if both use lists?

1 Like

when provided which is dependend to the selectedTargetFramework as activity:

  • Append Item toList - adds 1 item to the List and is directly adding it to the same list object
  • Append Item to Collection - can add 1 or more items to a list, but will return a new fresh list on which the origin and the items to add are concatenated

As also mentioned in the link (when a not direct addition is needed, and only one item is to add)

Assign Activity:
myList = myList.Append(“MyOtherStringItem”).toList

or for multiple items
myCollection1.Concat(myCollection2).toList

1 Like

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