Skip to content

Instantly share code, notes, and snippets.

@mvacha
Last active June 24, 2016 11:54
Show Gist options
  • Save mvacha/542f7b7bfaf5837b0f3ae6be25d4e1d8 to your computer and use it in GitHub Desktop.
Save mvacha/542f7b7bfaf5837b0f3ae6be25d4e1d8 to your computer and use it in GitHub Desktop.
static State Request(this State state, Transition transition) =>
(state, transition) match
(
case (State.Running, Transition.Suspend): State.Suspended
case (State.Suspended, Transition.Resume): State.Running
case (State.Suspended, Transition.Terminate): State.NotRunning
case (State.NotRunning, Transition.Activate): State.Running
case *: throw new InvalidOperationException()
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment