Binstate 2.0.2

Requires NuGet 2.8 or higher.

dotnet add package Binstate --version 2.0.2                
NuGet\Install-Package Binstate -Version 2.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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                
#r "nuget: Binstate, 2.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. 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                

Binstate

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

https://github.com/Ed-Pavlov/Binstate#readme

Features

  • 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
    .If(CheckOverload).Goto(MovingUp)
    .Otherwise().Execute(AnnounceOverload)
    

    Binstate allows using C#

    ✔️

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

      builder
        .DefineState(WaitingForGame)
        .OnExit<string>(WaitForGame)
        .AddTransition<string>(GameStarted, TrackingGame, OnTransitionToTrackingGame)
        ...
    
      builder
        .DefineState(TrackingGame)
        .OnEnter<string>(TrackGame)
        ...
    
  • 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 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 was computed.  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. 
.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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
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 1,053 12/10/2021
1.1.18 559 4/3/2021
1.0.27 499 10/27/2020
1.0.26 426 10/26/2020
1.0.25 447 10/4/2020
1.0.24 468 9/28/2020
1.0.23 613 9/27/2020
1.0.21 466 9/27/2020
1.0.20 589 9/26/2020
1.0.19 449 9/24/2020
1.0.5 485 4/20/2020
1.0.4 487 4/17/2020
1.0.2 491 4/14/2020