4

Possible Duplicate:
Which are C# native built-in design patterns?
Design Patterns with C#

I got inspired from this question. I thought it would be nice to have examples in .net like the one in the link.

If some one could give details like that it just enhances the understanding of Design Patterns and makes them choose the best design pattern for the problem.

What I am looking is examples in Base class Library. If the moderators feels that if this is not an answerable question or off the topic please let me know I will delete it.

Community
  • 1
  • 1
Sandeep
  • 7,156
  • 12
  • 45
  • 57
  • It's a duplicate, some question you may use: http://stackoverflow.com/questions/4323809/design-patterns-with-c-sharp or http://stackoverflow.com/questions/1789591/design-patterns-in-net – Amittai Shapira Feb 28 '12 at 15:32

3 Answers3

2

Just google for "gof .net"

Here's some of the first results:

http://www.dofactory.com/Patterns/Patterns.aspx

http://www.codeproject.com/Articles/3130/Illustrated-GOF-Design-Patterns-in-C-Part-I-Creati

The first link is very good:

To give you a head start, the C# source code is provided in 2 forms: 'structural' and 'real-world'. Structural code uses type names as defined in the pattern definition and UML diagrams. Real-world code provides real-world programming situations where you may use these patterns.

A third form, '.NET optimized' demonstrates design patterns that exploit built-in .NET 4.0 features, such as, generics, attributes, delegates, object and collection initializers, automatic properties, and reflection. These and much more are available in our Design Pattern Framework 4.0TM. See our Singleton page for a .NET 4.0 Optimized code sample.

Jakub Konecki
  • 45,581
  • 7
  • 87
  • 126
2

Most OOP design patterns are language agnostic, so you can usually port the concept to C# VB .NET etc.

I have found this site to be very useful.

I also found the Head First Design Patterns book really useful, the ideas stick because they use simple, clear real world examples and they intersperse it with pictures :0). The examples are in Java but C# is far from different.

Paulie Waulie
  • 1,690
  • 13
  • 23
2

Most people seem to have ignored the 'base class' note in your question; have a look at this: http://msdn.microsoft.com/en-us/magazine/cc188707.aspx

Dave
  • 3,581
  • 1
  • 22
  • 25