
What is the need for Chain of Responsibility Pattern in C# (C Sharp)?Generally
the sender and receiver will be strongly coupled. If you prefer to avoid
it then you can implement Chain of Responsibility Pattern where in, message
sent by sender can be received by a set of objects existing in the chain,
and one object from this chain will be handling the request message sent
by the sender. Here is a code snippet showing creation of chain of receivers: In the above
shown code, the processRequest method of receiver class passes the request
to the next object in the chain. You can define derivedReceiver1, derivedReceiver2
and derivedReceiver3 classes which are all derived from receiver class.
In these classes, you can override processRequest method to add conditions
which when evaluated to true, the request can be processed. If not, the
request can be moved to the next object in chain.
_______________________________________________________________________
FREE
Subscription
Subscribe
to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________ |