Binstate 2.0.2

.NET Standard 2.0

Requires NuGet 2.8 or higher.

Install-Package Binstate -Version 2.0.2
dotnet add package Binstate --version 2.0.2
<PackageReference Include="Binstate" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Binstate --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Binstate, 2.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Binstate as a Cake Addin
#addin nuget:?package=Binstate&version=2.0.2

// Install Binstate as a Cake Tool
#tool nuget:?package=Binstate&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Binstate is a simple but yet powerful state machine for .NET. Thread safe. Supports async methods. Supports hierarchically nested states.

See documentation for full details


  • Thread safety

    The state machine is fully thread safe and allows calling any method from any thread.

  • Control on what thread enter and exit actions are executed

    Binstate don't use it's own thread to execute transitions. It gives an application full control over the threading model of the state machine.

  • Support async methods

  • Hierarchically nested states

    Supports hierarchically nested states, see "Elevator" example.

  • Conditional transitions using C# not DSL

    Instead of introducing conditional transition into state machine's DSL like

    .If(CallDialled, Ringing, () => IsValidNumber)
    .If(CallDialled, Beeping, () => !IsValidNumber);
    // or

    Binstate allows using C#


    .AddTransition(CallDialed, () => IsValidNumber ? Ringing : Beeping)
    .AddTransition(GoUp, () =>
        if(CheckOverload) return MovingUp;
        return null; // no transition will be executed
  • Enter/Exit/OnTransition actions with arguments

        .AddTransition<string>(GameStarted, TrackingGame, OnTransitionToTrackingGame)
  • Relaying arguments attached to a state through states upon activation

    • Argument for relaying can be gotten from one of the parent of the active state if the active state itself has no argument.
    • Argument will be relayed to all parent states of the newly activated state if they require an argument.
    • If a state already has 'tuple' argument, it can be split by two when relaying to the newly activated state (and its parents) depending on their 'enter' actions argument
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 164 12/10/2021
1.1.18 359 4/3/2021
1.0.27 296 10/27/2020
1.0.26 231 10/26/2020
1.0.25 270 10/4/2020
1.0.24 285 9/28/2020
1.0.23 407 9/27/2020
1.0.21 275 9/27/2020
1.0.20 398 9/26/2020
1.0.19 245 9/24/2020
1.0.5 293 4/20/2020
1.0.4 301 4/17/2020
1.0.2 287 4/14/2020