Export (0) Print
Expand All

IfElseActivity Class

Conditionally runs one of two or more activities of type IfElseBranchActivity. This class cannot be inherited.

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

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

This activity provides semantics similar to two If-ElseIf statements.

IfElseActivity contains an ordered set of IfElseBranchActivity classes and runs the first branch when the condition evaluates to true. The final branch is not required to have a condition, in which case it always evaluates to true.

A IfElseActivity can complete without having run any child activity, if no conditions are satisfied.

The following code example shows how to create a new instance of the IfElseActivity class and add two IfElseBranchActivity classes to it. This code example is part of the SequentialWorkflowWithParameters SDK Sample from the SequentialWorkflow.cs file. For more information, see Sequential Workflow With Parameters.

Me.CanModifyActivities = True 
Dim codecondition1 As System.Workflow.Activities.CodeCondition = New System.Workflow.Activities.CodeCondition
Me.ifElseActivity = New System.Workflow.Activities.IfElseActivity
Me.approveIfElseBranch = New System.Workflow.Activities.IfElseBranchActivity
Me.rejecteIfElseBranch = New System.Workflow.Activities.IfElseBranchActivity
Me.approve = New System.Workflow.Activities.CodeActivity
Me.reject = New System.Workflow.Activities.CodeActivity
'  
' ifElseActivity 
'  
Me.ifElseActivity.Activities.Add(Me.approveIfElseBranch)
Me.ifElseActivity.Activities.Add(Me.rejecteIfElseBranch)
Me.ifElseActivity.Name = "ifElseActivity"

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

Community Additions

ADD
Show:
© 2014 Microsoft