ForEach<T> Activity Designer

The ForEach<T> activity executes the activity contained in its Body for each item in a specified Values collection.

ForEach<T> Properties in the Workflow Designer

The following table shows the most useful ForEach<T> activity properties and describes how to use them in the designer.

Property Name Required Usage
DisplayName False The friendly name of the ForEach<T> activity. The default is ForEach<Int32>. Although the DisplayName value is not strictly required, it is a best practice to use one.
Values True The collection of items to iterate over. To set the Values, type a Visual Basic expression in the Values box on the ForEach<T> activity designer or in the property grid.
TypeArgument True The type of the items in the Values collection specified by the generic parameter T. By default, TypeArgument is set to Int32. To change the type, change the value of the TypeArgument combo box in the property grid.

By default, the loop iterator is named item. You can change the name of the iterator variable in the ForEach<T> activity designer. The loop iterator can be used in expressions in the children of the ForEach<T> activity.

See Also

ParallelForEach<T> Control Flow