![]() ![]() So, instead of checking for new products every now and then, they can just subscribe to the seller and receive real-time updates. Let’s say we have an e-commerce application, where some customers are interested in the products of a particular seller. This pattern is helpful whenever we want to implement some kind of distributed notification system within our application. This predefined condition is usually an event or a state change. An Observer can subscribe to a Provider and get notified whenever a predefined condition happens. ![]() On the other hand, there are one or more Observers, which are objects subscribing to the Provider. So, on one hand, we have a Provider (sometimes called a Subject or a Publisher) which is the observed object. It enables multiple objects to subscribe to another object and get notified when an event occurs to this observed object. The Observer design pattern allows us to establish a notification mechanism between objects. If you want to read more about design patterns in C#, you can inspect our C# Design Patterns page. To download the source code for this article, you can visit our GitHub repository.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |