Represents a state in a StateMachineWorkflowActivity.
Assembly: System.Workflow.Activities (in System.Workflow.Activities.dll)
The represents a State in a StateMachineWorkflowActivity. State activities could contain one or more EventDrivenActivity, or classes, one StateInitializationActivity class, and one StateFinalizationActivity class. SetState activities are used inside an EventHandlersActivity and StateInitializationActivity to move the state of the workflow.
When a is executing, the only events that can be received are the events that can be handled by the EventDrivenActivity activities in the and also the EventDrivenActivity activities attached to the enclosing activities and the root Activity.
When the starts running, the will check to see whether a StateInitializationActivity activity is present or not. The can have zero or one StateInitializationActivity activity. If a StateInitializationActivity activity is present the StateInitializationActivity will be executed. As soon as the StateInitializationActivity activity finishes, the blocks events so that the only receives events that can be handled by its EventDrivenActivity activities.
The is a CompositeActivity, meaning the activity can contain other activities.
The following code example shows how to create a new instance of the class and use it implement a simple state machine to transition between 3 states. This code example is part of the SimpleStateMachineWorkflow SDK sample from the StateMachineWorkflow.cs file. For more information, see Simple State Machine.
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.