Design Patterns in .NET

Learn the most important design patterns using C# and .NET.

  • 3 Days
  • Intermediate
  • In-person / Online
  • £ On Request


This course is designed for C# developers who want to extend their architectural skills using design patterns and related techniques. The delivery is tailored to the .NET platform and uses .NET libraries and frameworks wherever possible to illustrate how patterns can be usefully applied. Additional examples are drawn from Ruby, Java/JEE, C++ and Scala.

Each pattern is introduced in terms of its abstract structure (via UML diagrams), its benefits and drawbacks, sample implementations and practical examples of how it can be used to simplify software development.


Introduction to Patterns

  • What is a design pattern?
  • The evolution of design patterns
  • Misconceptions about design patterns
  • The dangers of becoming 'pattern happy'
  • Distinguishing between patterns, idioms and refactorings
  • Using refactorings to introduce patterns incrementally
  • Using patterns to create an object-oriented architecture


  • Why MVC is the most important pattern in enterprise architecture
  • How the pattern is applied in web frameworks like ASP.NET MVC
  • Guidelines for applying MVC successfully in your own designs
  • Why Microsoft evolved MVP and MVVM out of conventional MVC
  • How MVVM is used in WPF and Windows 11 user interfaces

The Little Language Pattern

  • Understanding Little Language and Domain Specific Languages
  • Support for DSLs in .NET via CodeDom and T4 Templates
  • LINQ as an example of an Internal DSL

The Observer Pattern

  • The disconnect between OO design and event handling
  • How the Observer pattern enables event-driven OO code
  • The classical implementation of Observer using interfaces
  • The .NET (and Delphi) version of Observer using delegates

The Iterator Pattern

  • Accessing an aggregate object without knowing its representation
  • How Iterator is used in the C++, Java and .NET collection libraries
  • Adding iterator support to your own C# collection classes

The Singleton Pattern

  • Why ensure a class only has a single instance?
  • Singleton objects verses static utility classes
  • The classical implementation of the Singleton pattern
  • Language specific solutions to Singleton in C# and Scala
  • Making Singletons safe and efficient in concurrent code
  • Problems with the double-checked locking idiom

Patterns Relating to Factories

  • Advantages of separating clients from object creation
  • Comparing the Factory Method and Abstract Factory Patterns
  • Using Abstract Factory to conceal providers in ADO.NET
  • Extending the Factory Pattern into Dependency Injection
  • Examples of Dependency Injection Tools for .NET

The Strategy Pattern

  • Creating class hierarchies to represent algorithms
  • Separating a class from a changing or complex algorithm
  • How Strategy is used with Layout Managers in WPF
  • How Strategy is used within mocking tools like Moq

The Command Pattern

  • Similarities between Strategy and Command
  • Using Command objects to simplify event dispatching
  • Incrementally refactoring code to introduce Command
  • Uses of the Command Pattern in Web Frameworks

The Proxy Pattern

  • Adding services by intercepting messages
  • Dynamically creating proxy classes via Reflection
  • How proxies can be used for Aspect Oriented Programming
  • The interception framework provided with .NET

The Template Method Pattern

  • Using polymorphism to customise algorithms
  • Similarities between Template and Factory Method

The Decorator and Adapter Patterns

  • Using composition to layer extra functionality
  • Applying Decorator to create specialised collections
  • Distinguishing between Adapter and Decorator
  • Uses of these patterns in the .NET I/O libraries


  • Simplifying class design by modelling operations as visitors
  • Adding support for Visitor to existing collections of objects
  • Using Visitor to add reporting and logging behaviour
  • Code generation in C# with Visitor and the CodeDOM library
  • Using Visitor in the design of a C# mock objects generator

The State Pattern

  • Benefits of the State Pattern over subclassing
  • Modelling objects with complex internal state transitions
  • Different approaches to implementing state transitions
  • Automatically generating state machines

Parallel Programming Patterns

  • Introducing the .NET Parallel Patterns
  • Working with thread pools and IOU's
  • The async/await keywords


Delegates should have at least 3 years experience in C# development and be familiar with UML Sequence and Class diagrams.


Design Patterns in .NET

Learn the most important design patterns using C# and .NET.

  • 3 Days
  • Intermediate
  • In-person / Online
  • £ On Request

Deloitte logo
Atlassian logo
Bose logo
Workday logo
BMW logo
Amex logo
McAfee logo
PWC logo