© Vaskaran Sarcar 2020
V. SarcarDesign Patterns in C#https://doi.org/10.1007/978-1-4842-6062-3_8

8. Adapter Pattern

Vaskaran Sarcar1 
Garia, Kolkata, West Bengal, India

This chapter covers the Adapter pattern.

GoF Definition

Convert the interface of a class into another interface client’s expect. Adapter lets classes work together that otherwise could not because of incompatible interfaces.


From the GoF definition, you can guess that this pattern deals with at least two incompatible inheritance hierarchies. In a domain-specific system, the clients are habituated on how to invoke methods in software. Those methods can follow an inheritance hierarchy. Now assume that you need to upgrade your system and need to implement a new inheritance hierarchy. ...

Get Design Patterns in C#: A Hands-on Guide with Real-world Examples now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.