Share via


While and Parallel Sample

Download sample

The sample demonstrates the use of ParallelActivity activities with CodeActivity activities in a WhileActivity activity. Inside the WhileActivity activity, there is a ParallelActivity activity with two SequenceActivity activities, each with a CodeActivity activity. The condition for the while loop is that the execution count is less than or equal to two, which allows the loop to execute two times.

After the workflow instance is started, the condition for the while loop is checked. If the condition evaluates to true, the while loop executes and the sequential activities run. The CodeActivity activities print their status information to the console. After that, the while loop executes again. When the while loop condition evaluates to false, the workflow stops.

The console output from the sample appears as follows:

Whiel and Parallel Sample Output

To build the sample

  1. Download the sample by clicking Download Sample in this topic.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the WhileAndParallel\bin\debug folder (or the WhileAndParallel\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

See Also

Reference

ParallelActivity
WhileActivity

Other Resources

Using the Parallel Activity
Using the While Activity
Using Activities to Control Flow
Using Conditions in Workflows
Activities Samples
Windows Workflow Foundation Samples

© 2007 Microsoft Corporation. All rights reserved.