Description

Removes an item from a specified collection.



Attributes

Misc

  • Collection - The name of the list where the item would be removed.

  • DisplayName - Renames the activity.

  • Item - The item that the user wants to remove from a collection.

  • Result - True or False boolean result if an item was removed from the collection.

  • TypeArgument - The type assigned to the collection.


Example

  1. Create a List<String> variable and name it fruits.
  2. Add an Assign activity inside the initial Sequence.
  3. In the Assign To field, add the fruits variable.
  4. In the Assign Value field, write new List(Of String) since its default value is null.
  5. After the Assign activity, add an Add To Collection activity. 
  6. In the Add To Collection Collection field under Attributes, add the fruits variable.
  7. In the Add To Collection Item field, write "apple".
  8. Add your second Add To Collection activity.
  9. In the Add To Collection Item field, write "pear".
  10. After the Add To Collection activity, add a For Each activity.
  11. In the For Each Values field, add the fruits variable.
  12. Inside the For Each activity, add a Write Line activity.
  13. In the Write Line Text field, add the item variable.
  14. After the For Each activity, add another Write Line activity.
  15. In the Write Line Text field, write "end of collection". This is to distinguish the end of the collection.
  16. After the Write Line activity, add a Remove From Collection activity.
  17. In the Remove From Collection Collection field under Attributes, add the fruits variable.
  18. In the Remove From Collection Item field, write "apple".
  19. Copy the For Each activity and then paste it after the Remove From Collection activity.

    The use case should look as the following screenshot:



This should be the result in the Output panel: