This documentation is archived and is not being maintained.

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)

public final class IfElseActivity extends CompositeActivity implements IActivityEventListener<ActivityExecutionStatusChangedEventArgs>

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.

No code example is currently available or this language may not be supported.

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