๐Ÿงฉ Design Patterns with .NET / C#
Home Chapters Examples Diagrams Bibliography GitHub โ†—
  1. Home
  2. Selecting and Varying Behaviour
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.

Read โ†’
Chapter 12

Template Method and the delegate alternative

Where an inheritance-based skeleton still fits, and where a delegate replaces it.

Read โ†’
Chapter 13

State and finite state machines

A real state machine and a probabilistic variant, with pattern matching reshaping both.

Read โ†’
Chapter 14

Command, undo, and Task-returning commands

Delegates as commands, reversible operations, and command queues that return Task.

Read โ†’
โ† Previous part The .NET Substrate Next part โ†’ Creating Objects Under Control
Design Patterns with .NET / C#
Tutorial content: CC BY 4.0. Sample code: Apache 2.0.
Source on GitHub โ†—  ยท  File an issue โ†—