Does C# include finite state machines?

.NET 4 Update 1 now supports it in the following class: System.Activities.Statements.StateMachine

Here is a tutorial on how to use it. Here's a hands on lab.


Workflow Foundation (.NET 3.0) has a state machine workflow. 4.0 doesn't have exactly the same thing currently, but you can definitely create a state machine workflow using 4.0.


I maintain an open-source project which implements (among other things) a generic finite state machine for .NET. It is built on top of QuickGraph, so you get many graph-analysis algorithms for free.

See this page for more information about the project, and specifically "Jolt.Automata : Finite State Machines" for more information about the feature.