Design Patterns in C#
Minimum price
Suggested price

Design Patterns in C#

About the Book

This book provides a modern, comprehensive overview of design pattern implementations for the .NET ecosystem using the C# programming language. The book covers every single pattern from the Gang of Four and a few extras such as enterprise and functional design patterns.

About the Author

Dmitri Nesteruk
Dmitri Nesteruk

Dmitri Nesteruk is a developer, speaker, podcaster and a technologist. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. He is an instructor of an entry-level course in Quantitative Finance. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.

Table of Contents

    • Introduction
      • Who This Book Is For
      • On Code Examples
      • Preface to the 2nd Edition
    • The SOLID Design Principles
      • Single Responsibility Principle
      • Open-Closed Principle
      • Liskov Substitution Principle
      • Interface Segregation Principle
      • Dependency Inversion Principle
    • The Functional Perspective
      • Function Basics
      • Functional Literals in C#
      • Storing Functions in C#
      • Functional Literals in F#
      • Composition
      • Functional-Related Language Features
  • Creational Patterns
    • Builder
      • Scenario
      • Simple Builder
      • Fluent Builder
      • Communicating Intent
      • Composite Builder
      • Builder Parameter
      • Builder Extension with Recursive Generics
      • Lazy Functional Builder
      • DSL Construction in F#
      • Summary
    • Factories
      • Scenario
      • Factory Method
      • Asynchronous Factory Method
      • Factory
      • Inner Factory
      • Abstract Factory
      • Delegate Factories in IoC
      • Functional Factory
      • Summary
    • Prototype
      • Deep vs. Shallow Copying
      • ICloneable Is Bad
      • Deep Copying with a Special Interface
      • Deep Copying Objects
      • Duplication via Copy Construction
      • Serialization
      • Prototype Factory
      • Summary
    • Singleton
      • Singleton by Convention
      • Classic Implementation
      • The Trouble with Singleton
      • Singletons and Inversion of Control
      • Monostate
      • Multiton
      • Summary
  • Structural Patterns
    • Adapter
      • Scenario
      • Adapter
      • Adapter Temporaries
      • The Problem with Hashing
      • Property Adapter (Surrogate)
      • Generic Value Adapter
      • Adapter in Dependency Injection
      • Adapters in the .NET Framework
      • Summary
    • Bridge
      • Conventional Bridge
      • Dynamic Prototyping Bridge
      • Summary
    • Composite
      • Grouping Graphic Objects
      • Neural Networks
      • Shrink Wrapping the Composite
      • Composite Specification
      • Summary
    • Decorator
      • Custom String Builder
      • Adapter-Decorator
      • Multiple Inheritance with Interfaces
      • Multiple Inheritance with Default Interface Members
      • Dynamic Decorator Composition
      • Static Decorator Composition
      • Functional Decorator
      • Summary
    • Façade
      • Magic Squares
      • Building a Trading Terminal
      • An Advanced Terminal
      • Where’s the Façade?
      • Summary
    • Flyweight
      • User Names
      • Text Formatting
      • Summary
    • Proxy
      • Protection Proxy
      • Property Proxy
      • Value Proxy
      • Composite Proxy: SoA/AoS
      • Composite Proxy with Array-Backed Properties
      • Virtual Proxy
      • Communication Proxy
      • Dynamic Proxy for Logging
      • Summary
  • Behavioral Patterns
    • Chain of Responsibility
      • Scenario
      • Method Chain
      • Broker Chain
      • Summary
    • Command
      • Scenario
      • Implementing the Command Pattern
      • Undo Operations
      • Composite Commands (a.k.a. Macros)
      • Functional Command
      • Queries and Command Query Separation
      • Summary
    • Interpreter
      • Numeric Expression Evaluator
      • Interpretation in the Functional Paradigm
      • Summary
    • Iterator
      • Array-Backed Properties
      • Let’s Make an Iterator
      • Improved Iteration
      • Iterator Adapter
      • Summary
    • Mediator
      • Chat Room
      • Mediator with Events
      • Introduction to MediatR
      • Summary
    • Memento
      • Bank Account
      • Undo and Redo
      • Using Memento for Interop
      • Summary
    • Null Object
      • Scenario
      • Intrusive Approaches
      • Null Object
      • Dynamic Null Object
      • Summary
    • Observer
      • Events
      • Weak Event Pattern
      • Event Streams
      • Property Observers
      • Observable Collections
      • Declarative Subscriptions in Autofac
      • Summary
    • State
      • State Driven State Transitions
      • Handmade State Machine
      • Switch-Based State Machine
      • Encoding Transitions with Switch Expressions
      • State Machines with Stateless
      • Summary
    • Strategy
      • Dynamic Strategy
      • Static Strategy
      • Equality and Comparison Strategies
      • Functional Strategy
      • Summary
    • Template Method
      • Game Simulation
      • Functional Template Method
      • Summary
    • Visitor
      • Intrusive Visitor
      • Reflective Printer
      • What is Dispatch?
      • Dynamic Visitor
      • Classic Visitor
      • Acyclic Visitor
      • Functional Visitor
      • Summary
  • Notes

Authors have earned$9,542,965writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub