Stateless 5.20.0
See the version list below for details.
dotnet add package Stateless --version 5.20.0
NuGet\Install-Package Stateless -Version 5.20.0
<PackageReference Include="Stateless" Version="5.20.0" />
<PackageVersion Include="Stateless" Version="5.20.0" />
<PackageReference Include="Stateless" />
paket add Stateless --version 5.20.0
#r "nuget: Stateless, 5.20.0"
#:package Stateless@5.20.0
#addin nuget:?package=Stateless&version=5.20.0
#tool nuget:?package=Stateless&version=5.20.0
Stateless
Create state machines and lightweight state machine-based workflows directly in .NET code:
var phoneCall = new StateMachine<State, Trigger>(State.OffHook);
phoneCall.Configure(State.OffHook)
.Permit(Trigger.CallDialled, State.Ringing);
phoneCall.Configure(State.Connected)
.OnEntry(t => StartCallTimer())
.OnExit(t => StopCallTimer())
.InternalTransition(Trigger.MuteMicrophone, t => OnMute())
.InternalTransition(Trigger.UnmuteMicrophone, t => OnUnmute())
.InternalTransition<int>(_setVolumeTrigger, (volume, t) => OnSetVolume(volume))
.Permit(Trigger.LeftMessage, State.OffHook)
.Permit(Trigger.PlacedOnHold, State.OnHold);
// ...
phoneCall.Fire(Trigger.CallDialled);
Assert.AreEqual(State.Ringing, phoneCall.State);
This project, as well as the example above, was inspired by Simple State Machine (Archived).
Features
Most standard state machine constructs are supported:
- Generic support for states and triggers of any .NET type (numbers, strings, enums, etc.)
- Hierarchical states
- Entry/exit actions for states
- Guard clauses to support conditional transitions
- Introspection
Some useful extensions are also provided:
- Ability to store state externally (for example, in a property tracked by an ORM)
- Parameterised triggers
- Reentrant states
- Export to DOT and Mermaid graph
Documentation
For guidance on how to use Stateles, the project README file contains documentation and code examples. The source repository also includes a few example projects.
Contributing
We welcome contributions to this project. Check CONTRIBUTING.md for more info.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (68)
Showing the top 5 NuGet packages that depend on Stateless:
| Package | Downloads |
|---|---|
|
LittleForker
A utility to assist with spawing child processes, monitor their lifecycle and co-operative shutdown. |
|
|
DiegoRangel.DotNet.Framework.CQRS.Domain.Core
A common library for implementing CQRS based Domain layer. |
|
|
RedoSocial.Platform.ViewModels.Rx
Package Description |
|
|
Hyperledger.Aries
.NET Core tools for building agent services |
|
|
Delfin.Core.Application
A robust Application Layer library designed to facilitate the implementation of business logic and application services in .NET applications. This package provides essential abstractions, command and query handling, and integration with domain models, ensuring a clean architecture and separation of concerns. |
GitHub repositories (15)
Showing the top 15 popular GitHub repositories that depend on Stateless:
| Repository | Stars |
|---|---|
|
microsoft/ailab
Experience, Learn and Code the latest breakthrough innovations with Microsoft AI
|
|
|
github/VisualStudio
GitHub Extension for Visual Studio
|
|
|
sipsorcery-org/sipsorcery
A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
|
|
|
Azure/iotedge
The IoT Edge OSS project
|
|
|
fagenorn/handcrafted-persona-engine
An AI-powered interactive avatar engine using Live2D, LLM, ASR, TTS, and RVC. Ideal for VTubing, streaming, and virtual assistant applications.
|
|
|
dotnetGame/MineCase
Minecraft server based on Orleans
|
|
|
pardahlman/RawRabbit
A modern .NET framework for communication over RabbitMq
|
|
|
NimbleSense/Susalem
加入带锅宫酱,来到苏州耶路撒冷的怀抱吧!
|
|
|
JasonBock/Rocks
A mocking library based on the Compiler APIs (Roslyn + Mocks)
|
|
|
CrossGeeks/xUber
Uber Clone using Xamarin Forms
|
|
|
DynamicTranslator/DynamicTranslator
Instant translation application for windows in .NET :circus_tent:
|
|
|
damianh/LittleForker
A .NET utility library to spawn, supervise and (optionally) cleanly shut down child processes.
|
|
|
mrsalmon1976/Stateless.WorkflowEngine
Basic .NET workflow engine based on the awesome stateless State Machine.
|
|
|
Kaioru/Edelstein
A v.95.1 Mushroom game server emulator written in C# .NET
|
|
|
Enzx/NxGraph
NxGraph is a zero-allocation runtime, high-performance finite state machine (FSM) framework for .NET 8+, designed for scenarios where execution speed, memory efficiency, and runtime safety are critical.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.20.1-dev-19407615528 | 269 | 11/16/2025 |
| 5.20.1-dev-19407520956 | 217 | 11/16/2025 |
| 5.20.0 | 196,841 | 9/18/2025 |
| 5.20.0-dev-17841589139 | 307 | 9/18/2025 |
| 5.19.0 | 85,665 | 8/22/2025 |
| 5.19.0-dev-17621326750 | 310 | 9/18/2025 |
| 5.19.0-dev-17157499513 | 139 | 8/22/2025 |
| 5.18.0 | 87,825 | 8/3/2025 |
| 5.18.0-dev-17151133875 | 154 | 8/22/2025 |
| 5.18.0-dev-17151048893 | 148 | 8/22/2025 |
| 5.18.0-dev-17123170070 | 174 | 8/21/2025 |
| 5.18.0-dev-16986834496 | 165 | 8/15/2025 |
| 5.18.0-dev-16665478063 | 125 | 8/1/2025 |
| 5.18.0-dev-16665368567 | 134 | 8/1/2025 |
| 5.17.0 | 1,786,853 | 12/30/2024 |
| 5.17.0-dev-16123181037 | 186 | 7/7/2025 |
| 5.17.0-dev-12573353197 | 206 | 1/1/2025 |
| 5.17.0-dev-12536414383 | 197 | 12/29/2024 |
| 5.16.0 | 2,166,637 | 5/24/2024 |
| 5.16.0-dev-9828500365 | 231 | 7/7/2024 |
| 5.16.0-dev-9514287026 | 199 | 6/14/2024 |
| 5.16.0-dev-9221217254 | 202 | 5/24/2024 |
| 5.16.0-dev-12536374438 | 157 | 12/29/2024 |
| 5.16.0-dev-12479904394 | 153 | 12/24/2024 |
| 5.16.0-dev-12470918423 | 170 | 12/23/2024 |
| 5.16.0-dev-12470449205 | 178 | 12/23/2024 |
| 5.16.0-dev-10048603300 | 205 | 7/22/2024 |
| 5.15.0 | 1,659,127 | 12/29/2023 |
| 5.15.0-dev-9171714096 | 191 | 5/21/2024 |
| 5.15.0-dev-9058520056 | 205 | 5/13/2024 |
| 5.15.0-dev-8822304149 | 189 | 4/24/2024 |
| 5.15.0-dev-8790594175 | 209 | 4/22/2024 |
| 5.15.0-dev-8759383160 | 202 | 4/19/2024 |
| 5.15.0-dev-7356157229 | 519 | 12/29/2023 |
| 5.14.0 | 479,602 | 11/14/2023 |
| 5.14.0-dev-7355700004 | 485 | 12/29/2023 |
| 5.14.0-dev-7309801955 | 505 | 12/23/2023 |
| 5.14.0-dev-7232734414 | 517 | 12/16/2023 |
| 5.14.0-dev-7232709282 | 532 | 12/16/2023 |
| 5.14.0-dev-7164312319 | 564 | 12/11/2023 |
| 5.14.0-dev-7078872236 | 556 | 12/3/2023 |
| 5.14.0-dev-7078811950 | 537 | 12/3/2023 |
| 5.14.0-dev-6860395514 | 583 | 11/14/2023 |
| 5.14.0-dev-6851669594 | 549 | 11/13/2023 |
| 5.14.0-dev-6851630770 | 555 | 11/13/2023 |
| 5.14.0-dev-6823242034 | 1,054 | 11/10/2023 |
| 5.14.0-dev-6813247520 | 581 | 11/9/2023 |
| 5.14.0-dev-6811706736 | 500 | 11/9/2023 |
| 5.14.0-dev-6801352798 | 557 | 11/8/2023 |
| 5.13.0 | 2,569,293 | 12/29/2022 |
| 5.13.0-dev-6799430915 | 524 | 11/8/2023 |
| 5.13.0-dev-6746401636 | 548 | 11/7/2023 |
| 5.13.0-dev-5455458583 | 907 | 7/4/2023 |
| 5.13.0-dev-5455401408 | 744 | 7/4/2023 |
| 5.13.0-dev-5235510771 | 765 | 6/11/2023 |
| 5.13.0-dev-5157129238 | 807 | 6/2/2023 |
| 5.13.0-dev-4941000713 | 979 | 5/10/2023 |
| 5.13.0-dev-4940972813 | 953 | 5/10/2023 |
| 5.13.0-dev-4838097297 | 776 | 4/29/2023 |
| 5.13.0-dev-4838091545 | 814 | 4/29/2023 |
| 5.13.0-dev-4838052982 | 774 | 4/29/2023 |
| 5.13.0-dev-4832488606 | 789 | 4/28/2023 |
| 5.13.0-dev-4716514070 | 780 | 4/17/2023 |
| 5.13.0-dev-4701624597 | 820 | 4/14/2023 |
| 5.13.0-dev-4701061956 | 796 | 4/14/2023 |
| 5.13.0-dev-4027208421 | 830 | 1/27/2023 |
| 5.13.0-dev-4027203589 | 854 | 1/27/2023 |
| 5.13.0-dev-4027201259 | 858 | 1/27/2023 |
| 5.13.0-dev-3800477155 | 793 | 12/29/2022 |
| 5.12.0 | 931,656 | 10/17/2022 |
| 5.12.0-dev-3553426836 | 837 | 11/26/2022 |
| 5.12.0-dev-3498786305 | 809 | 11/18/2022 |
| 5.12.0-dev-3267018252 | 847 | 10/17/2022 |
| 5.11.0 | 4,968,545 | 4/28/2021 |
| 5.11.0-dev-3264102134 | 797 | 10/17/2022 |
| 5.11.0-dev-3191463566 | 810 | 10/17/2022 |
| 5.10.1 | 494,723 | 2/17/2021 |
| 5.10.1-dev-791423646 | 1,021 | 4/28/2021 |
| 5.10.1-dev-787896296 | 1,019 | 4/27/2021 |
| 5.10.1-dev-787889564 | 1,039 | 4/27/2021 |
| 5.10.1-dev-574334224 | 1,051 | 2/17/2021 |
| 5.10.0 | 5,548 | 2/14/2021 |
| 5.10.0-dev-560201439 | 997 | 2/12/2021 |
| 5.10.0-dev-560186344 | 1,026 | 2/12/2021 |
| 5.10.0-dev-542672901 | 1,172 | 2/6/2021 |
| 5.10.0-dev-542661127 | 1,055 | 2/6/2021 |
| 5.2.0 | 6,421 | 2/15/2021 |
| 5.2.0-dev-568743626 | 1,077 | 2/15/2021 |
| 5.1.9-dev-00610 | 1,073 | 2/6/2021 |
| 5.1.9-dev-00600 | 1,072 | 1/31/2021 |
| 5.1.8 | 611,180 | 1/13/2021 |
| 5.1.8-dev-00558 | 1,053 | 1/16/2021 |
| 5.1.8-dev-00553 | 1,064 | 1/13/2021 |
| 5.1.7 | 29,338 | 1/10/2021 |
| 5.1.7-dev-00548 | 1,128 | 1/10/2021 |
| 5.1.6 | 3,592 | 1/10/2021 |
| 5.1.6-dev-00547 | 1,128 | 1/10/2021 |
| 5.1.6-dev-00544 | 1,095 | 1/10/2021 |
| 5.1.5 | 570,039 | 11/17/2020 |
| 5.1.5-dev-00528 | 1,082 | 11/17/2020 |
| 5.1.4 | 98,222 | 11/7/2020 |
| 5.1.4-dev-00522 | 1,120 | 11/7/2020 |
| 5.1.4-dev-00521 | 1,144 | 11/7/2020 |
| 5.1.3 | 1,373,756 | 8/13/2020 |
| 5.1.3-dev-00520 | 1,199 | 11/7/2020 |
| 5.1.3-dev-00513 | 1,146 | 8/12/2020 |
| 5.1.2 | 716,432 | 4/27/2020 |
| 5.1.2-dev-00508 | 1,078 | 8/12/2020 |
| 5.1.2-dev-00501 | 1,146 | 4/27/2020 |
| 5.1.1 | 186,862 | 4/3/2020 |
| 5.1.1-dev-00500 | 1,189 | 4/27/2020 |
| 5.1.1-dev-00499 | 1,144 | 4/27/2020 |
| 5.1.1-dev-00492 | 1,199 | 4/3/2020 |
| 5.1.0 | 55,492 | 3/28/2020 |
| 5.1.0-dev-00489 | 1,188 | 4/3/2020 |
| 5.1.0-dev-00486 | 1,181 | 4/3/2020 |
| 5.1.0-dev-00485 | 1,202 | 4/3/2020 |
| 5.1.0-dev-00481 | 1,201 | 3/26/2020 |
| 5.1.0-dev-00480 | 1,204 | 3/26/2020 |
| 5.1.0-dev-00479 | 1,120 | 3/25/2020 |
| 5.1.0-dev-00478 | 1,172 | 3/25/2020 |
| 5.1.0-dev-00477 | 1,122 | 3/24/2020 |
| 5.0.0 | 258,468 | 2/29/2020 |
| 5.0.0-dev-00476 | 1,166 | 3/24/2020 |
| 5.0.0-dev-00473 | 1,169 | 3/13/2020 |
| 5.0.0-dev-00472 | 1,153 | 3/13/2020 |
| 5.0.0-dev-00471 | 1,159 | 3/13/2020 |
| 5.0.0-dev-00464 | 1,182 | 2/27/2020 |
| 5.0.0-dev-00463 | 1,254 | 2/27/2020 |
| 4.4.0 | 268,171 | 2/7/2020 |
| 4.4.0-dev-00453 | 1,243 | 2/6/2020 |
| 4.4.0-dev-00451 | 1,205 | 2/6/2020 |
| 4.4.0-dev-00450 | 1,169 | 2/6/2020 |
| 4.4.0-dev-00447 | 1,205 | 2/6/2020 |
| 4.4.0-dev-00445 | 1,142 | 2/6/2020 |
| 4.4.0-dev-00443 | 1,484 | 2/6/2020 |
| 4.3.0 | 272,516 | 11/18/2019 |
| 4.2.1 | 3,578,727 | 6/2/2018 |
| 4.2.0 | 22,640 | 6/1/2018 |
| 4.2.0-dev-00366 | 1,940 | 6/2/2018 |
| 4.2.0-dev-00364 | 1,777 | 6/1/2018 |
| 4.2.0-dev-00363 | 1,980 | 6/1/2018 |
| 4.2.0-dev-00360 | 1,967 | 6/1/2018 |
| 4.2.0-dev-00355 | 2,109 | 5/31/2018 |
| 4.2.0-dev-00350 | 2,072 | 5/28/2018 |
| 4.2.0-dev-00349 | 2,074 | 5/28/2018 |
| 4.1.0 | 42,450 | 5/18/2018 |
| 4.1.0-dev-00341 | 1,992 | 5/18/2018 |
| 4.1.0-dev-00340 | 1,930 | 5/18/2018 |
| 4.1.0-dev-00337 | 1,981 | 5/18/2018 |
| 4.1.0-dev-00331 | 2,164 | 5/15/2018 |
| 4.1.0-dev-00326 | 1,814 | 5/14/2018 |
| 4.1.0-dev-00319 | 4,277 | 5/11/2018 |
| 4.1.0-dev-00316 | 1,821 | 5/11/2018 |
| 4.1.0-dev-00311 | 2,075 | 5/7/2018 |
| 4.1.0-dev-00307 | 2,009 | 5/4/2018 |
| 4.1.0-dev-00299 | 1,842 | 4/27/2018 |
| 4.0.1-dev-00294 | 2,254 | 4/24/2018 |
| 4.0.1-dev-00275 | 13,458 | 3/24/2018 |
| 4.0.1-dev-00260 | 7,448 | 10/18/2017 |
| 4.0.1-dev-00258 | 2,026 | 10/16/2017 |
| 4.0.1-dev-00256 | 2,269 | 10/6/2017 |
| 4.0.0 | 783,020 | 9/30/2017 |
| 4.0.0-dev-00247 | 3,671 | 7/27/2017 |
| 4.0.0-dev-00244 | 3,088 | 6/15/2017 |
| 4.0.0-dev-00242 | 2,208 | 6/13/2017 |
| 4.0.0-dev-00236 | 1,924 | 6/1/2017 |
| 4.0.0-dev-00223 | 1,984 | 5/19/2017 |
| 4.0.0-dev-00221 | 1,874 | 5/17/2017 |
| 4.0.0-dev-00220 | 1,812 | 5/17/2017 |
| 4.0.0-dev-00217 | 3,049 | 5/15/2017 |
| 4.0.0-dev-00196 | 2,394 | 4/6/2017 |
| 4.0.0-dev-00194 | 1,836 | 4/6/2017 |
| 4.0.0-dev-00187 | 1,879 | 4/6/2017 |
| 4.0.0-dev-00177 | 2,002 | 3/24/2017 |
| 4.0.0-dev-00175 | 1,855 | 3/24/2017 |
| 4.0.0-dev-00173 | 1,878 | 3/24/2017 |
| 3.2.0-dev-00170 | 2,306 | 3/24/2017 |
| 3.2.0-dev-00168 | 1,908 | 3/20/2017 |
| 3.2.0-dev-00166 | 2,073 | 2/28/2017 |
| 3.1.1-dev-00165 | 2,174 | 2/28/2017 |
| 3.1.1-dev-00162 | 1,859 | 2/28/2017 |
| 3.1.1-dev-00155 | 1,885 | 2/20/2017 |
| 3.1.1-dev-00152 | 2,044 | 2/7/2017 |
| 3.1.1-dev-00151 | 1,973 | 1/22/2017 |
| 3.1.1-dev-00143 | 1,974 | 1/3/2017 |
| 3.1.1-dev-00141 | 1,991 | 1/2/2017 |
| 3.1.0 | 869,015 | 12/15/2016 |
| 3.0.2-dev-00132 | 2,533 | 12/8/2016 |
| 3.0.1 | 16,553 | 11/23/2016 |
| 3.0.1-dev-00123 | 1,912 | 11/22/2016 |
| 3.0.1-dev-00113 | 2,293 | 11/11/2016 |
| 3.0.0 | 111,751 | 11/3/2016 |
| 3.0.0-dev-00109 | 2,062 | 11/2/2016 |
| 3.0.0-dev-00108 | 1,962 | 11/2/2016 |
| 3.0.0-dev-00106 | 1,942 | 11/2/2016 |
| 3.0.0-dev-00105 | 2,116 | 11/1/2016 |
| 3.0.0-dev-00099 | 2,152 | 10/31/2016 |
| 3.0.0-dev-00094 | 2,889 | 10/3/2016 |
| 3.0.0-dev-00093 | 1,838 | 10/3/2016 |
| 3.0.0-dev-00092 | 1,904 | 10/3/2016 |
| 2.5.84 | 119,247 | 8/23/2016 |
| 2.5.80 | 56,914 | 7/25/2016 |
| 2.5.79 | 79,089 | 7/19/2016 |
| 2.5.68 | 13,352 | 7/1/2016 |
| 2.5.66 | 2,524 | 6/30/2016 |
| 2.5.62 | 25,446 | 3/29/2016 |
| 2.5.61 | 40,825 | 3/22/2016 |
| 2.5.59 | 4,283 | 3/7/2016 |
| 2.5.56 | 19,707 | 2/25/2016 |
| 2.5.53 | 100,351 | 2/3/2016 |
| 2.5.40 | 7,790 | 1/25/2016 |
| 2.5.36 | 23,366 | 12/10/2015 |
| 2.5.29 | 42,251 | 11/7/2015 |
| 2.5.28 | 2,534 | 11/7/2015 |
| 2.5.23 | 4,570 | 10/28/2015 |
| 2.5.21 | 43,462 | 7/6/2015 |
| 2.5.18 | 9,581 | 6/9/2015 |
| 2.5.15 | 13,802 | 4/9/2015 |
| 2.5.11 | 70,661 | 10/26/2014 |
| 2.5.10 | 2,709 | 10/23/2014 |
| 2.5.8 | 7,800 | 10/20/2014 |
| 2.4.0 | 64,566 | 3/19/2013 |
| 2.3.1.1 | 55,136 | 1/7/2011 |