© 2026 Dometrain. All rights reserved.
Learn how to implement and combine the behavioral design patterns in C#
Behavioral design patterns provide the established vocabulary for how objects communicate and delegate responsibilities, but implementing them correctly is the difference between a flexible system and a mess of over-engineered abstractions. This course is a hands-on guide to implementing these patterns effectively in modern C#. We’ll start with core patterns for processing requests and actions, building a Chain of Responsibility into a complete request middleware pipeline and evolving the Command pattern to support an undo history stack and a replayable command log. You’ll then refactor tightly-coupled components, replacing direct peer-to-peer references with a Mediator and implementing a moderated broadcast hub, while also tackling state management by replacing a giant switch on a state field with a proper State machine, complete with entry and exit actions and guarded transitions.
From there, we’ll focus on encapsulating algorithms and behavior. You’ll see how to implement the Strategy pattern not just with interfaces but also with Func delegates to build a routing strategy with fallbacks. We’ll use the Template Method to define a reusable skeleton for a data import pipeline with optional hooks, and master the Observer pattern by moving from basic interfaces to native C# events with EventHandler and the IObservable and IObserver interfaces from System. You’ll learn to handle complex object structures with Iterator, building from a manual cursor to using yield return and a paged cursor with lookahead, and with Visitor, using double dispatch to walk an expression tree. The course concludes by showing you how these patterns work together in the real world, where you’ll combine Command and Memento for an undoable counter, Observer and Mediator for a routed event bus, and even Template Method, Strategy, and Observer to construct a small workflow engine.