Observer Pattern in .NET

See the original posting on DZone Python


I have previously written a few posts about delegates, .NET Events, Events Args to show that similar to real-world events, we can use this concept in our code and how useful they are in certain scenarios. This post will see that those types are a good candidate for implementing the observer pattern without doing anything extra. We will learn some terminologies and see a working example as well.

If you are new to .NET Events, I will suggest reading my previous posts on the topic, and then discussed in this post will be easier to follow. So let’s talk about observer pattern: