Skip to content

This repo consists of Design Patterns Creational, Structural, Behavioral Patterns and Solid principle in C#

Notifications You must be signed in to change notification settings

rajhseg/DesignPatterns_CSharp_Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

DesignPatterns_CSharp

This repo consists of Sample code for Design Patterns and Solid principle in C#.

ModelBinder.cs file consists of sample

Method for converting DataTable <=> Model (Collection) Binder (Needs Testing with sample values).

Method for Cloning a C# Object (Deep Cloning). (Needs Testing with sample values)

  1. Solid Principle
    1. Open Close Principle
    2. Single Responsibility Principle
    3. Liskov Substitution Principle
    4. Interface Seggregation Principle
    5. Dependency Inversion Principle

Creational Pattern

  1. Singleton - Class has only one instance.
  1. FactoryMethod - An interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created.
  1. AbstractFactory - Provide an interface for creating families of related objects without specifying their concrete classes.
  1. Builder - Construct complex objects step-by-step.
  1. Prototype - Create new objects by copying an existing object.

Structural Pattern

  1. Adapter - Convert the interface of a class into another interface the client expects.
  1. Bridge - Decouple an abstraction from its implementation.
  1. Composite - Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions uniformly.
  1. Decorator - Allows behavior to be added to an individual object, dynamically, without modifying its class.
  1. Facade - Provides a simplified interface to a complex subsystem. It hides the complexities of the system and provides an easier way to interact with it.
  1. Flyweight - Minimizing memory usage by sharing as much data as possible with similar objects.
  1. Proxy - Provides a surrogate or placeholder for another object to control access to it. It allows you to add functionality (like lazy loading, access control, logging, etc.) without changing the original object's code.

Behavioral Pattern

  1. Iterator - Provides a way to access elements of a collection sequentially without exposing its underlying representation.
  1. Chain of Responsiblity - Allows passing a request along a chain of handlers. Each handler decides either to process the request or to pass it to the next handler in the chain.
  1. Observor - Establish a publish-subscribe relationship where subjects notify observers about state changes without being tightly coupled.
  1. TemplateMethod - defines the skeleton of an algorithm in a base class but lets subclasses override specific steps without changing the overall algorithm’s structure.
  1. Memento - Capture and externalize an object's internal state so that the object can be restored to that state later—without violating encapsulation


About

This repo consists of Design Patterns Creational, Structural, Behavioral Patterns and Solid principle in C#

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages