Search code examples
c#.netdesign-patternsobserver-pattern

Could we say that each class that define an event in C# is a subject of an observer pattern?


I would like to understand. In C# could we say that each class that define an event is a subject of an (hypothetical) observer pattern?


Solution

  • Yes, you can. Though there is also an IObserver Interface in the .NET Framework, events are the best way to do it. You can read Microsoft's desctiption on the matter.