Table of Contents
Activity Program Name
Description
Properties
Usage
1. Activity Program Name
System.Activities.Statements.ExistsInCollection
2. Description
Up to Studio Version 2.0.2.0
Quick Access: Toolbox > Collections > Exists in Collection
From Studio Version 2.0.3.0
Quick Access: Toolbox > System > Collections > Exists in Collection
This activity checks whether the specified item exists within a collection.
Verified in Studio Version: 2.1.1.2
The wording may vary slightly depending on the version.
3. Properties
4. Usage
The following example demonstrates checking for the existence of a specific item in a newly created List of type String.
Drag and drop the Assign activity from System > Originals to the designer panel.
In the To field under Miscellaneous properties, enter a variable of type List<String> (e.g., sample).
(Refer to the "Creating Variables" guide for details.)
In the Value field, enter: new List(Of String) From {"A", "B", "C"}
Drag and drop the Exists in Collection activity from System > Collections to the designer panel.
Click the TypeArgument property under Miscellaneous and select String.
In the Collection field, enter the List<String> variable (e.g., sample).
In the Result field, enter a variable of type Boolean (e.g., result).
In the Item field, enter a string or String type variable (e.g., "A").
To verify the execution results, drag and drop the Write Line activity from System > Originals to the designer panel and configure it with: result.ToString
Click Home > Start or press F5 to run the workflow. Open the output panel and verify the results.
If the item "A" exists in the collection, the output will display:
True
Example with "A" as the specified item:
If the item "D" is specified (which does not exist in the collection), the output will display: False
Example with "D" as the specified item:
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article