Skip to content
C# Design Patterns Tutorial Sample Code
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Builder Gradually writing factory pattern May 7, 2019
FactoryMethod tidy up for the series structure Nov 21, 2018
.gitignore removed .vscode Aug 29, 2018
DesignPatterns.sln Builder pattern example May 1, 2019
LICENSE Initial commit Aug 28, 2018

Software Design Patterns in C# and .net core

In software development a Software Design Pattern is a reusable solution to commonly recurring problems. A software design pattern is a description or template used to solve a problem that can be used in many different situations.

In 1994, the so called Gang Of Four (GOF) published their book Design Patterns: Elements of Reusable Object-Oriented Software in which they presented a catalog of simple and succinct solutions to commonly occurring design problems.

The book captured 23 Patterns that enabled software architects to create flexible, elegant and ultimately reusable design patterns without having to rediscover or reinvent the design solutions for themselves.

Through a series of blog posts on I will discuss these patterns and more on how C# .net core developers can implement these patterns in cross platform .net core software solutions.


Software Design patterns are typically categorised into three groups.

Creational Patterns
Simple Factory interfaces for creating objects without exposing the object creation logic
Factory Method Creates an instance of several derived classes
Abstract Factory Creates an instance of several families of classes
Builder Separates object construction from its representation
Prototype A fully initialized instance to be copied or cloned
Singleton A class of which only a single instance can exist

Structural Patterns
Adapter Match interfaces of different classes
Bridge Separates an object’s interface from its implementation
Composite A tree structure of simple and composite objects
Decorator Add responsibilities to objects dynamically
Facade A single class that represents an entire subsystem
Flyweight A fine-grained instance used for efficient sharing
Proxy An object representing another object

Behavioral Patterns
Chain of Responsibility A way of passing a request between a chain of objects
Command Encapsulate a command request as an object
Interpreter A way to include language elements in a program
Iterator Sequentially access the elements of a collection
Mediator Defines simplified communication between classes
Memento Capture and restore an object's internal state
Observer A way of notifying change to a number of classes
State Alter an object's behavior when its state changes
Strategy Encapsulates an algorithm inside a class
Template Method Defer the exact steps of an algorithm to a subclass
Visitor Defines a new operation to a class without change

Sponsored by

threenine logo

You can’t perform that action at this time.