This article describes the Observer design pattern. This is a
behavioral design pattern, a category of
design pattern used by software engineers, when writing computer programs.
Table of Contents
Introduction
The Observer pattern (also known as Publish/Subscribe pattern) is a
design pattern, used in software engineering to allow an object to maintain a list of observers, subscribers or listeners. The object can then notify them of changes, usually by calling their methods or through eventing.
It is defined as a
behavioral design pattern, because the program reacts to changes from the observed object.
Benefits
It creates a one-to-many relationship, so one object can maintain a list and easily inform many others of a change of state.
Examples of the pattern
C# has the IObserver<T> Interface to provide notification.
Read more and download the example from here code.msdn.microsoft.com/Dive-into-Observer-Pattern-00fa8573
See Also
Link to domain parent articles and related articles in TechNet Wiki.
Community Resources
These are the external links, including links to Microsoft and TechNet sites that are non-Wiki
References section
Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.- [Please contribute]