Design patterns are solutions to common problems and complexities in software design. As we have discussed here before, they are classified into three distinct categories: creational, structural, and behavioral. The chain of responsibility design pattern falls under the behavioral category and can be used to reduce coupling between the sender of a request and the receiver object that handles the request.
The Gang of Four definition of the chain of responsibility design pattern:
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
Essentially, in the chain of responsibility design pattern you have a list or a chain of objects that may handle a request. Each object can either handle the request or forward the request to another handler. In this article we’ll discuss the purpose of the chain of responsibility design pattern and how it can be implemented in C#.