In C#, isn't the observer pattern already implemented using Events?


Question

After reading the Head First Design Patterns book and using a number of other design patterns, I'm trying to understand the Observer pattern. Isn't this already implemented using Events in the .NET Framework?

1
32
2/24/2016 10:50:19 AM

Accepted Answer

Yes, it is. The observer pattern is also called the publish/subscribe pattern, which is exactly what events allow you to do.

25
8/28/2008 11:38:45 AM

I would say yes, it was Anders Heljsberg's intent to make the observer pattern a first-class language feature with events in C#, based on his experience with Delphi. Anders makes this and other design intentions clear in an excellent interview on Software Engineering Radio.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon