This documentation is archived and is not being maintained.

ParallelActivity Class

Runs a set of child activities at the same time. This class cannot be inherited.

Namespace:  System.Workflow.Activities
Assembly:  System.Workflow.Activities (in System.Workflow.Activities.dll)

[ToolboxBitmapAttribute(typeof(ParallelActivity), "Resources.Parallel.png")]
public sealed class ParallelActivity : CompositeActivity, 

The order in which child activities are run is non-deterministic.

The ParallelActivity is a CompositeActivity, which means the ParallelActivity can contain other activities. The SequenceActivity activity is the only activity that can be the child of a ParallelActivity.

Only one activity can run at a time.

The ParallelActivity only finishes when all children are complete.

The ParallelActivity is especially useful when there are one or more blocking activities, such as the DelayActivity activity, in one or more of the branches. In this scenario, the ParallelActivity actually switches to a different branch when the DelayActivity is blocked. If there are no blocking activities in any one of the ParallelActivity branches then the activity uses a non-deterministic sequence.

The following code example shows how to create a new instance of the ParallelActivity class, add the ParallelActivity class to the WhileActivity class, and add two SequenceActivity classes to the ParallelActivity class. This code example is part of the WhileAndParallel SDK sample from the WhileAndParallelWorkflow.Designer.cs file. For more information, see Using While and Parallel.

workflowRuntime.WorkflowLoaded += OnWorkflowLoad;

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0