© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
D. NesterukDesign Patterns in .NET 6https://doi.org/10.1007/978-1-4842-8245-8_22

22. Observer

Dmitri Nesteruk1  
(1)
St. Petersburg, c.St-Petersburg, Russia
 

The Observer pattern, quite simply, lets one component notify other components that something happened. The pattern is used all over the place: for example, when binding data to UI, we can program domain objects such that, when they change, they generate notifications that the UI can subscribe to and update the visuals. On the other hand, editing data in the UI should modify data behind the scenes, which requires the reverse set of operations to occur.

Events

The Observer pattern is a popular and necessary ...

Get Design Patterns in .NET 6: Reusable Approaches in C# and F# for Object-Oriented Software Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.