This documentation is archived and is not being maintained.

WhileActivity Class

Runs a child activity iteratively as long as a certain condition is true.

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

'Declaration
<ToolboxBitmapAttribute(GetType(WhileActivity), "Resources.While.png")> _
Public NotInheritable Class WhileActivity _
	Inherits CompositeActivity _
	Implements IActivityEventListener(Of ActivityExecutionStatusChangedEventArgs)
'Usage
Dim instance As WhileActivity

The WhileActivity is a CompositeActivity, meaning the WhileActivity can contain other activities.

Before each iteration, the Condition property is evaluated. If the Condition property evaluates to false, the WhileActivity immediately finishes.

The following code example demonstrates how to create a new instance of the WhileActivity class and add the ParallelActivity class to the WhileActivity 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.

AddHandler currentWorkflowRuntime.WorkflowUnloaded, AddressOf OnWorkflowUnloaded

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
Show: