Part 5
4 chapters
Selecting and Varying Behaviour
Strategy, Template Method, State, and Command, and the delegate and keyed-service idioms that reshape them in C#.
Chapter 11
Strategy: delegates, interfaces, and keyed services
Three levels of the same pattern: pass a Func, define an interface, or register keyed services, and when each is the right reach.
Chapter 12
Template Method and the delegate alternative
Where an inheritance-based skeleton still fits, and where a delegate replaces it.
Chapter 13
State and finite state machines
A real state machine and a probabilistic variant, with pattern matching reshaping both.
Chapter 14
Command, undo, and Task-returning commands
Delegates as commands, reversible operations, and command queues that return Task.