Observer design pattern

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
C# Design Patterns
edit
C# design pattern in a nutshell…
The Observer design pattern defines a one-to-many dependency between objects. So, when an object changes state, all its dependents are notified and updated automatically..


The Observer design pattern .

Use the Observer pattern when…

  • an abstraction has two aspects—each one dependent on the other. Encapsulating these aspects into separate objects lets you vary and reuse them independently.
  • a change to one object requires changing othersl; but, you don't know how many objects need to be changed.
  • an object must be able to notify other objects without making assumptions about what these objects are—loosely coupled.


C# design pattern at a glance…

Observer designs subjects and observers to be loosely coupled. It…

  • xxx

Observer is useful for listening for changes of state, for example:

  • listening for an external event, e.g. a user GUI action
  • listening for changes in a property value of an object


Classic Observer design pattern



Previous_Page_.gif Next_Page_.gif

Personal tools