1) Use a boolean flag (IsForEachActive) set to true:
ForEach<T> If IsForEachActive Sequence If (Need to exit) IsForEachActive = False Else
The ForEach<T> will continue to itterate through the collection, but no action will be performed, so it should not be a big perf hit.
2) Build a custom ForEach<T> with an exit option.
If you create a custom activity you can change the way the ForEach<T> works. I think the ForEach<T> is sealed, so you will have to derive from something higher up. (Reflector can help to see how the ForEach<T> is written.)
www.CloudCasts.net - Community Webcasts Powered by Azure