Take the 2-minute tour ×

I am a senior level developer but I haven't had a lot of formal training and I although I have used many design patterns and seen them used in my years as a developer, no one really went out of their way to say. "Oh this is an observer pattern, or this is a Singleton pattern."

Reading over some of the design patterns, I came across the Observer pattern and it seems to be to be very similar to the way the .NET framework events work. Am I missing something fundamental about this?

share|improve this question

4 Answers 4

up vote 13 down vote accepted

The .NET Event model is pretty much a integrated implementation of the observer pattern in the common language runtime. The .NET languages implement observer directly in their language specific manner, using the framework's built-in support for this.

In most programming languages, the observer pattern requires customized development or libraries.

It comes for free as part of the language in C#, VB.NET and most other languages built to use the CLR.

share|improve this answer
.NET is not a language, .NET is a runtime environment. –  CyberSpock Apr 30 '09 at 16:57
True. I was refering to the CLR, more than a specific language, but was non-specific in my post. Edited to be more clear. Thank you for the comment. –  Reed Copsey Apr 30 '09 at 17:09

Many event models, like the Java 1.1 and beyond, as well as the .NET event model are basically implementations of the Observer pattern.

Note that this even applies to older mechanisms, such as using callback methods in C for event handling. It's the same intent, just implemented slightly differently.

share|improve this answer


Those of you with passing familiarity of the types exposed in the FCL will note that no IObserver, IObservable, or ObservableImpl types are present in the Framework. The primary reason for their absence is the fact that the CLR makes them obsolete after a fashion. Although you can certainly use these constructs in a .NET application, the introduction of delegates and events provides a new and powerful means of implementing the Observer pattern without developing specific types dedicated to support this pattern. In fact, as delegates and events are first class members of the CLR, the foundation of this pattern is incorporated into the very core of the .NET Framework. As such, the FCL makes extensive use of the Observer pattern throughout its structure.

share|improve this answer
Nice theory. Too bad they left out some important details (like having the event publisher give the subscriber a token it can use to unsubscribe, or having a means by which the publisher can ask subscribers if they're still "interested" in their subscriptions. As it is, if many instances of an object which attaches itself to a long-lived object's Disposed event are created and abandoned, there's no means by which those subscriptions will get cleaned up during long-lived object's lifetime. Even if one used client-side weak events, there'd be no way for the event publisher.... –  supercat Jan 27 '13 at 22:24
...to know when their target went out of scope. Publisher-side weak might be a little better, but are only efficient if the client is required to hold a strong reference to its own delegate (which is not a usual requirement for events). –  supercat Jan 27 '13 at 22:27

Why do you think there must be a difference?

Don't you think the .NET designers read Design Patterns as well?

Actually, the Observer pattern (like all in the book) were well known long before they were categorized and named by the Gof4. It was used to implement the .Net event model, as well as the Win32 & Win16 event models, and probably many others.

share|improve this answer
I didn't say there must be a difference. I was asking if I missed something. (-1 aggresive non-answer) –  Jeff Martin Apr 30 '09 at 16:33
Lol @ agressive non-answer –  Janie Jul 15 '09 at 18:10
this answer is good +1 –  chikak Dec 12 '09 at 14:42
+1 answer was not agressive. After all a 'senior' developer should have some knowledge of design patterns IMO. –  Finglas Dec 12 '09 at 20:51
How does my ignorance make the answer less agressive? –  Jeff Martin Dec 13 '09 at 16:29

Your Answer


