In this task, we will use the ExistsInCollection<T>
activity to check whether or not a specified item exists in the collection object.
We need to make sure we have finished the task of Printing collection items for us to be able to use CollectionPrinterActivity
in this task.
Create a Console Workflow Application:
Create a new Workflow Console Application and name it
UsingExistsInCollectionActivity
.We need to perform the following actions to create a workflow:
Open
Workflow1.xaml
, which is the workflow created by default. Click the Imports button and type inSystem.Collections.ObjectModel
to import theSystem.Collections.ObjectModel
namespace to this workflow.Drag a Sequence activity into the designer panel. Next, drag an
ExistsInCollection
activity right below theCollectionPrinter
activity—the type isString
. Now drag aWriteLine
activity below theExistsCollection
activity. Add a newICollection...