Clears all of the items within a collection.



  • Collection - The name of the list where all of the items would be cleared.

  • DisplayName - Renames the activity.

  • TypeArgument - The type assigned to the collection.


  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 seconds Add To Collection activity.
  9. In the second Add To Collection Collection field under Attributes, add the fruits variable.
  10. In the Add To Collection Item field, write "pear".
  11. Create a String variable and name it item.
  12. After the second Add To Collection activity, add a For Each activity.
  13. In the For Each Values field, add the fruits variable.
  14. Inside the For Each activity, add a Write Line activity.
  15. In the Write Line Text field, add the item variable.
  16. After the For Each activity, add a Clear Collection activity.
  17. In the Clear Collection Collection field, add the fruits variable. This would clear all the items inside the specified collection. 

    The use case should look as the following screenshot:

After execution, the added items in the collection should be cleared.