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
- Create a List<String> variable and name it fruits.
- Add an Assign activity inside the initial Sequence.
- In the Assign To field, add the fruits variable.
- In the Assign Value field, write new List(Of String) since its default value is null.
- After the Assign activity, add an Add To Collection activity.
- In the Add To Collection Collection field under Attributes, add the fruits variable.
- In the Add To Collection Item field, write "apple".
- Add your second Add To Collection activity.
- In the Add To Collection Item field, write "pear".
- After the Add To Collection activity, add a For Each activity.
- In the For Each Values field, add the fruits variable.
- Inside the For Each activity, add a Write Line activity.
- In the Write Line Text field, add the item variable.
- After the For Each activity, add another Write Line activity.
- In the Write Line Text field, write "end of collection". This is to distinguish the end of the collection.
- After the Write Line activity, add a Remove From Collection activity.
- In the Remove From Collection Collection field under Attributes, add the fruits variable.
- In the Remove From Collection Item field, write "apple".
- 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: