I would like to know: are any GoF design patterns are used in the .NET Framework?
BOUNTY:
I have seen the MSDN link below in an answer. Are there any post/video or can you can list patterns and most importantly WHERE it is used?
I would like to know: are any GoF design patterns are used in the .NET Framework?
BOUNTY:
I have seen the MSDN link below in an answer. Are there any post/video or can you can list patterns and most importantly WHERE it is used?
Definitely. For instance, Factory pattern is used in ADO.NET data provider classes. Singleton pattern is used in .NET remoting. Dispose pattern is used in resource management.
Here's an article that discusses this very topic:
http://msdn.microsoft.com/en-us/magazine/cc188707.aspx
And now the MVC pattern can be added with ASP.NET MVC. :)
EDIT: Since your edit / request for more info:
Here's an article that lists several patterns and where they are used in the framework. http://www.jot.fm/issues/issue_2006_11/article1.pdf
The Providers in .NET are all the Provider model pattern. http://msdn.microsoft.com/en-us/library/aa479030.aspx
The provider patterns in .NET also use the Strategy Pattern.
The factory pattern is used in several places and here's a sample where it's used in ASP.NET. http://msdn.microsoft.com/en-us/library/ms954600.aspx
Here's a webcast on DP's in .NET: http://msevents.microsoft.com/cui/WebCastEventDetails.aspx?culture=en-US&EventID=1032293567&CountryCode=US
I haven't watched it so I am not sure how much it goes into how they are used in the Framework...
As already mentioned in a comment, the GoF patterns are likely all in use in the .NET framework. Where is not exactly the easiest to answer as the framework is massive and unless MS publishes as such listed in some of the examples given it is not always obvious. The more familiar one is with a pattern the more likely you would notice a framework class that was employing it.
Hopefully the extra links I have added help you.
Additionally, http://www.dofactory.com/Framework/Framework.aspx has a for sale kit ($79-99) that is about teaching how to use/implement GoF patterns in .NET BUT they do list on the reading they will also explain where MS uses them in the Framework.
The BeginXXX and EndXXX methods in the BCL are based loosely on the Asynchronous Completion Token pattern.
Read the "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries". This book will show you the real design patterns that .NET was based on.
The .NET framework uses many of the Gang of Four patterns. Here are just a few examples:
System.Data.Common.DbProviderFactory
. Every member function of this class is a factory method.System.Data.IDbConnection.BeginTransaction()
. The type of transaction created depends on the underlying IDbConnection implementation.System.Data.SqlClient.SqlConnection
, System.Data.OleDb.OleDbConnection
etc. Each provider is an adapter for its specific database.System.Windows.Forms.Control
and its derived classes.System.Web.UI.Control
and its derived classes.System.Xml.XmlNode
and its derived classes.System.Windows.Controls.Decorator
(in WPF).System.Xml.Serialization.XmlSerializer
. XmlSerializer hides a complex task (that includes generating assemblies on the fly!) behind a very easy-to-use class.System.ServiceModel.ClientBase<TChannel>
.System.Web.UI.Control.OnBubbleEvent()
and System.Web.UI.Control.RaiseBubbleEvent()
. System.Windows.Input.ICommand
(in WPF).System.Linq.Expressions.Expression
and related classes.System.Collections.IEnumerable
.System.Collections.Generic.IEnumerable<T>
.System.Data.IDataReader
.Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy
and related classes (ok it's not in the framework itself).System.Linq.Expressions.ExpressionVisitor
(used internally by LINQ).