Singleton pattern

A singleton is used to return a class which has only one instance, and you need a single point of access to the class. The pattern below instanciates the object as soon as the application starts.

private static MyClass singeton;

public static MyClass Singleton
          if(singleton == null)
               return new MyClass();
          return singleton;


To ensure that there really is only one instance of the class, you can use a sealed class. This way the class is only instanciated when the cass is first used.

public sealed class Singleton
     private static violatile Singleton instance;
     private static object syncRoot=

to be continued…

Repository pattern

Pub/Sub pattern

Factory pattern

A factory creates different types of object depending on the need. This is generally done by using a switch case to determine the type or using reflection to retrieve a list of classes which inherit

Factory method pattern

The factory method pattern creates factories, allowing the sub-factories to be more specific.

Abstract factory pattern

Strategy pattern

Bridge pattern

According to gang of 4 book, means two classes can change independently.

Builder pattern

Composite pattern

Facade pattern

Command pattern

Unit of work pattern

Null object pattern

Adapter pattern

One of the most common, this allows two classes expecting different interfaces or implementations to communicate with each other. The adapter pattern is an effective way to achieve the open/closed principle.

An implementation of ths pattern is the IDataAdapter used for communicating with ADO.NET.