There is a question already answered which is In C#, isn't the observer pattern already implemented using Events?
It asks if the observer pattern is already implemented in c# using events.
While I get the events and observer pattern, isn't the observer pattern really just delegates and events is a further implementation?
You are correct. An event is simply a delegate with some slightly different functionality. All of the observer pattern can be implemented with delegates without ever touching the event
keyword.
You may be interested then, in what the "event" keyword actually brings to the table.
Edit: Here's a great writeup with IL code comparison between events and delegates. (Hint: it's pretty much the same).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With