I'm using Visual Studio 2010 Beta 2 to get a head start on learning to use WF4. I'm working in the designer to create a xaml file. I've added a ForEach activity, and inside that ForEach activity have a flowchart that does some conditional processing. I want to be able to break out of the ForEach if one of the conditions is true, but can't figure out how to do so. In a C# code behind file that would just be to issue a break; , but in the xaml workflow designer, I don't see any mechanism for breaking from a loop. Any suggestions?
2 Answers
4
votes
0
votes
Using a While or DoWhile activity in place of a ForEach may be the best option for the activity's limitations on iteration control. It's a little uglier but works just as you're wanting your iteration to.
The conditional could check a bool, such as Broken, and a counter variable to compare it against the collections length. I'm not sure if this is the best for your scenario or for the collection your looping but seems like a viable option.