Sunteți pe pagina 1din 40

15/12/2018 DOT NET TRICKS: Design Patterns in C#

DOT NET TRICKS


Handy Tricks and Tips to do your .NET code Fast, Efficient and Simple.
Some common questions that comes into mind. Please check if you could
find them listed or not.

HOME ABOUT ME PEOPLE I ADMIRE CODEPROJECT DOTNETFUNDA DAILY DOTNET TIPS

MY INTERVIEW FAQ WPF TUTORIAL C# INTERNALS FORUM

Design Patterns in C#
Posted by Abhishek Sur on Wednesday, May 19, 2010
Labels: .NET, .NET 3.5, .NET Memory Management, Finalize, IDisposable, WPF
23 Comments

As I am doing a lot of architecture stuffs, lets discuss the very basics of


designing a good architecture. To begin with this, you must start with
Design patterns.

What is Design Patterns ?

Design patterns may be said as a set of probable solutions for a particular


problem which is tested to work best in certain situations. In other words,
Design patterns, say you have found a problem. Certainly, with the
evolution of software industry, most of the others might have faced the
same problem once. Design pattern shows you the best possible way to
solve the recurring problem.

Uses of Design Patterns

While creating an application, we think a lot on how the software will


behave in the long run. It is very hard to predict how the architecture will
work for the application when the actual application is built completely.
There might issues which you cant predict and may come while
implementing the software. Design patterns helps you to find tested
proven design paradigm. Following design pattern will prevent major
issues to come in future and also helps the other architects to easily
understand your code.

History of Design Patterns

When the word design pattern comes into mind, the first thing that one
may think is the classical book on Design Pattern "Gangs of Four" which
was published by Erich Gamma, Richard Helm, Ralph Johnson, and John
Vlissides. In this book, it is first discussed capabilities and pitfalls of Object

http://www.abhisheksur.com/2010/05/design-patterns.html 1/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

oriented programming, and later on it discusses about the classic Design


Patterns on OOPS.

Types of Design Pattern

Design patterns can be divided into 3 categories.

1. Creational Patterns : These patterns deals mainly with creation


of objects and classes.
2. Structural Patterns : These patterns deals with Class and Object
Composition.
3. Behavioural Patterns : These mainly deals with Class - Object
communication. That means they are concerned with the
communication between class and objects.

In this article, I am going to discuss few examples of these patterns.

You can Read the entire article from


http://www.dotnetfunda.com/articles/article889-design-pattern-
implementation-using-csharp-.aspx

or
CREATIONAL PATTERNS
Singleton Pattern

Singleton pattern creates a class which can have a single object


throughout the application, so that whenever any other object tries to
access the object of the class, it will access the same object always.

Implementation

/// <summary>
/// Implementation of Singleton Pattern
/// </summary>

http://www.abhisheksur.com/2010/05/design-patterns.html 2/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public sealed class SingleTon


{
private static SingleTon _instance =null;
private SingleTon() // Made default constructor as
private
{
}
/// <summary>
/// Single Instance
/// </summary>
public static SingleTon Instance
{
get
{
lock (_instance)
{
_instance = _instance ?? new SingleTon();
return _instance;
}
}
}

# region Rest of Implementation Logic

//Add As many method as u want here as instance


member. No need to make them static.

# endregion
}

In the above code you can see I have intentionally made the constructor
as private. This will make sure that the class cant be instantiated from
outside. On the other hand, you also need to make a property which will
return the static instance of the object present within the class itself. Hence
the object will be shared between all the external entities.

Factory Pattern

Factory pattern deals with the instantiation of object without exposing the
instantiation logic. In other words, a Factory is actually a creator of object
which has common interface.

http://www.abhisheksur.com/2010/05/design-patterns.html 3/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Implementation

//Empty vocabulary of Actual object


public interface IPeople
{
string GetName();
}

public class Villagers : IPeople


{

#region IPeople Members

public string GetName()


{
return "Village Guy";
}

#endregion
}

public class CityPeople : IPeople


{

#region IPeople Members

http://www.abhisheksur.com/2010/05/design-patterns.html 4/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public string GetName()


{
return "City Guy";
}

#endregion
}

public enum PeopleType


{
RURAL,
URBAN
}

/// <summary>
/// Implementation of Factory - Used to create objects
/// </summary>
public class Factory
{
public IPeople GetPeople(PeopleType type)
{
IPeople people = null;
switch (type)
{
case PeopleType.RURAL :
people = new Villagers();
break;
case PeopleType.URBAN:
people = new CityPeople();
break;
default:
break;
}
return people;
}
}

In the above code you can see I have created one interface called IPeople
and implemented two classes from it as Villagers and CityPeople. Based
on the type passed into the factory object, I am sending back the original
concrete object as the Interface IPeople.

http://www.abhisheksur.com/2010/05/design-patterns.html 5/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Factory Method

A Factory method is just an addition to Factory class. It creates the object


of the class through interfaces but on the other hand, it also lets the
subclass to decide which class to be instantiated.

IMPLEMENTATION

public interface IProduct


{
string GetName();
string SetPrice(double price);
}

public class IPhone : IProduct


{
private double _price;
#region IProduct Members

public string GetName()


{
return "Apple TouchPad";
}

public string SetPrice(double price)


{
this._price = price;
return "success";
}

http://www.abhisheksur.com/2010/05/design-patterns.html 6/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

#endregion
}

/* Almost same as Factory, just an additional exposure to


do something with the created method */
public abstract class ProductAbstractFactory
{
public IProduct DoSomething()
{
IProduct product = this.GetObject();
//Do something with the object after you get the
object.
product.SetPrice(20.30);
return product;
}
public abstract IProduct GetObject();
}

public class ProductConcreteFactory :


ProductAbstractFactory
{

public override IProduct GetObject() // Implementation


of Factory Method.
{
return this.DoSomething();
}
}

You can see I have used GetObject in concreteFactory. As a result, you


can easily call DoSomething() from it to get the IProduct.

You might also write your custom logic after getting the object in the
concrete Factory Method. The GetObject is made abstract in the Factory
interface.

Abstract Factory

Abstract factory is the extension of basic Factory pattern. It provides


Factory interfaces for creating a family of related classes. In other words,
here I am declaring interfaces for Factories, which will in turn work in

http://www.abhisheksur.com/2010/05/design-patterns.html 7/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

similar fashion as with Factories.

IMPLEMENTATION

public interface IFactory1


{
IPeople GetPeople();
}
public class Factory1 : IFactory1
{
public IPeople GetPeople()
{
return new Villagers();
}
}

public interface IFactory2


{
IProduct GetProduct();
}
public class Factory2 : IFactory2
{
public IProduct GetProduct()
{
return new IPhone();
}
}

public abstract class AbstractFactory12


{
public abstract IFactory1 GetFactory1();
public abstract IFactory2 GetFactory2();
}

http://www.abhisheksur.com/2010/05/design-patterns.html 8/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public class ConcreteFactory : AbstractFactory12


{

public override IFactory1 GetFactory1()


{
return new Factory1();
}

public override IFactory2 GetFactory2()


{
return new Factory2();
}
}

The factory method is also implemented using common interface each of


which returns objects.

Builder Pattern

This pattern creates object based on the Interface, but also lets the
subclass decide which class to instantiate. It also has finer control over the
construction process.

There is a concept of Director in Builder Pattern implementation. The


director actually creates the object and also runs a few tasks after that.

IMPLEMENTATION

public interface IBuilder


{
string RunBulderTask1();

http://www.abhisheksur.com/2010/05/design-patterns.html 9/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

string RunBuilderTask2();
}

public class Builder1 : IBuilder


{

#region IBuilder Members

public string RunBulderTask1()


{
throw new ApplicationException("Task1");
}

public string RunBuilderTask2()


{
throw new ApplicationException("Task2");
}

#endregion
}

public class Builder2 : IBuilder


{
#region IBuilder Members

public string RunBulderTask1()


{
return "Task3";
}

public string RunBuilderTask2()


{
return "Task4";
}

#endregion
}

public class Director


{
public IBuilder CreateBuilder(int type)
{
IBuilder builder = null;
if (type == 1)

http://www.abhisheksur.com/2010/05/design-patterns.html 10/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

builder = new Builder1();


else
builder = new Builder2();
builder.RunBulderTask1();
builder.RunBuilderTask2();
return builder;
}
}

In case of Builder pattern you can see the Director is actually using
CreateBuilder to create the instance of the builder. So when the Bulder is
actually created, we can also invoke a few common task in it.

Prototype Pattern

This pattern creates the kind of object using its prototype. In other words,
while creating the object of Prototype object, the class actually creates a
clone of it and returns it as prototype.

IMPLEMENTATION

public abstract class Prototype


{

// normal implementation

public abstract Prototype Clone();


}

http://www.abhisheksur.com/2010/05/design-patterns.html 11/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public class ConcretePrototype1 : Prototype


{

public override Prototype Clone()


{
return (Prototype)this.MemberwiseClone();
}
}

class ConcretePrototype2 : Prototype


{

public override Prototype Clone()


{
return (Prototype)this.MemberwiseClone(); //
Clones the concrete class.
}
}

You can see here, I have used MemberwiseClone method to clone the
prototype when required.

STRUCTURAL PATTERN
Adapter Pattern

Adapter pattern converts one instance of a class into another interface which
client expects. In other words, Adapter pattern actually makes two classes

compatible.

http://www.abhisheksur.com/2010/05/design-patterns.html 12/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

IMPLEMENTATION

public interface IAdapter


{
/// <summary>
/// Interface method Add which decouples the actual
concrete objects
/// </summary>
void Add();
}
public class MyClass1 : IAdapter
{
public void Add()
{
}
}
public class MyClass2
{
public void Push()
{

}
}
/// <summary>
/// Implements MyClass2 again to ensure they are in same
format.
/// </summary>
public class Adapter : IAdapter
{
private MyClass2 _class2 = new MyClass2();
http://www.abhisheksur.com/2010/05/design-patterns.html 13/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public void Add()


{
this._class2.Push();
}
}

Here in the structure, the adapter is used to make MyClass2 incompatible


with IAdapter.

Bridge Pattern

Bridge pattern compose objects in tree structure. It decouples abstraction


from implementation. Here abstraction represents the client where from
the objects will be called.

IMPLEMENTATION

# region The Implementation


/// <summary>
/// Helps in providing truely decoupled architecture
/// </summary>
public interface IBridge
{
void Function1();
void Function2();
}

public class Bridge1 : IBridge


{

http://www.abhisheksur.com/2010/05/design-patterns.html 14/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

#region IBridge Members

public void Function1()


{
throw new NotImplementedException();
}

public void Function2()


{
throw new NotImplementedException();
}

#endregion
}

public class Bridge2 : IBridge


{
#region IBridge Members

public void Function1()


{
throw new NotImplementedException();
}

public void Function2()


{
throw new NotImplementedException();
}

#endregion
}
# endregion

# region Abstraction
public interface IAbstractBridge
{
void CallMethod1();
void CallMethod2();
}

public class AbstractBridge : IAbstractBridge


{
public IBridge bridge;

http://www.abhisheksur.com/2010/05/design-patterns.html 15/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public AbstractBridge(IBridge bridge)


{
this.bridge = bridge;
}
#region IAbstractBridge Members

public void CallMethod1()


{
this.bridge.Function1();
}

public void CallMethod2()


{
this.bridge.Function2();
}

#endregion
}
# endregion

Thus you can see the Bridge classes are the Implementation, which uses
the same interface oriented architecture to create objects. On the other
hand the abstraction takes an object of the implementation phase and runs
its method. Thus makes it completely decoupled with one another.

Decorator Pattern

Decorator pattern is used to create responsibilities dynamically. That


means each class in case of Decorator patter adds up special
characteristics.In other words, Decorator pattern is the same as
inheritance.

http://www.abhisheksur.com/2010/05/design-patterns.html 16/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

IMPLEMENTATION

public class ParentClass


{
public void Method1()
{
}
}

public class DecoratorChild : ParentClass


{
public void Method2()
{
}
}

This is the same parent child relationship where the child class adds up
new feature called Method2 while other characteristics is derived from the
parent.

Composite Pattern

Composite pattern treats components as a composition of one or more


elements so that components can be separated between one another. In
other words, Composite patterns are those for whom individual elements
can easily be separated.

http://www.abhisheksur.com/2010/05/design-patterns.html 17/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

IMPLEMENTATION

/// <summary>
/// Treats elements as composition of one or more element,
so that components can be separated
/// between one another
/// </summary>
public interface IComposite
{
void CompositeMethod();
}

public class LeafComposite :IComposite


{

#region IComposite Members

public void CompositeMethod()


{
//To Do something
}

#endregion
}

/// <summary>
/// Elements from IComposite can be separated from others
/// </summary>
public class NormalComposite : IComposite
{

#region IComposite Members

http://www.abhisheksur.com/2010/05/design-patterns.html 18/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public void CompositeMethod()


{
//To Do Something
}

#endregion

public void DoSomethingMore()


{
//Do Something more .
}
}

Here in the code you can see that in NormalComposite, IComposite


elements can easily be separated.

Flyweight Pattern

Flyweight allows you to share bulky data which are common to each
object. In other words, if you think that same data is repeating for every
object, you can use this pattern to point to the single object and hence can
easily save space.

IMPLEMENTATION

/// <summary>
/// Defines Flyweight object which repeats iteself.
/// </summary>
public class FlyWeight
{
public string Company { get; set; }

http://www.abhisheksur.com/2010/05/design-patterns.html 19/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public string CompanyLocation { get; set; }


public string CompanyWebSite { get; set; }
//Bulky Data
public byte[] CompanyLogo { get; set; }
}
public static class FlyWeightPointer
{
public static FlyWeight Company = new FlyWeight
{
Company = "Abc",
CompanyLocation = "XYZ",
CompanyWebSite = "www.abc.com"
};
}
public class MyObject
{
public string Name { get; set; }
public FlyWeight Company
{
get
{
return FlyWeightPointer.Company;
}
}

Here the FlyweightPointer creates a static member Company, which is


used for every object of MyObject.

Memento Pattern

Memento pattern allows you to capture the internal state of the object
without violating encapsulation and later on you can undo/ revert the
changes when required.

http://www.abhisheksur.com/2010/05/design-patterns.html 20/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

IMPLEMENTATION

public class OriginalObject


{
public string String1 { get; set; }
public string String2 { get; set; }
public Memento MyMemento { get; set; }

public OriginalObject(string str1, string str2)


{
this.String1 = str1;
this.String2 = str2;
this.MyMemento = new Memento(str1, str2);
}
public void Revert()
{
this.String1 = this.MyMemento.String1;
this.String2 = this.MyMemento.String2;
}
}

public class Memento


{
public string String1 { get; set; }
public string String2 { get; set; }

public Memento(string str1, string str2)


{
this.String1 = str1;
this.String2 = str2;
}
}

Here you can see the Memento Object is actually used to Revert the
changes made in the object.

BEHAVIOURAL PATTERN
Mediator Pattern

http://www.abhisheksur.com/2010/05/design-patterns.html 21/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Mediator pattern ensures that the components are loosely coupled, such that
they don't call each others explicitly, rather they always use a separate Mediator

implementation to do those jobs.

IMPLEMENTATION

public interface IComponent


{
void SetState(object state);
}
public class Component1 : IComponent
{
#region IComponent Members

public void SetState(object state)


{
//Do Nothing
throw new NotImplementedException();
}

#endregion
}

public class Component2 : IComponent


{

#region IComponent Members

public void SetState(object state)


{
//Do nothing
throw new NotImplementedException();
}

http://www.abhisheksur.com/2010/05/design-patterns.html 22/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

#endregion
}

public class Mediator // Mediages the common tasks


{
public IComponent Component1 { get; set; }
public IComponent Component2 { get; set; }

public void ChageState(object state)


{
this.Component1.SetState(state);
this.Component2.SetState(state);
}
}

Here you can see the mediator Registers all the Components within it and
then calls its method when required.

Observer Pattern

When there are relationships between one or more objects, an observer


will notify all the dependent elements when something is modified in the
parent. Microsoft already implemented this pattern as
ObservableCollection. Here let me implement the most basic Observer
Pattern.

http://www.abhisheksur.com/2010/05/design-patterns.html 23/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

IMPLEMENTATION

public delegate void NotifyChangeEventHandler(string


notifyinfo);
public interface IObservable
{
void Attach(NotifyChangeEventHandler ohandler);
void Detach(NotifyChangeEventHandler ohandler);
void Notify(string name);
}

public abstract class AbstractObserver : IObservable


{
public void Register(NotifyChangeEventHandler handler)
{
this.Attach(handler);
}

public void UnRegister(NotifyChangeEventHandler


handler)
{
this.Detach(handler);
}

public virtual void ChangeState()


{
this.Notify("ChangeState");

#region IObservable Members

public void Attach(NotifyChangeEventHandler ohandler)


{
this.NotifyChanged += ohandler;
}

public void Detach(NotifyChangeEventHandler ohandler)


{
this.NotifyChanged -= ohandler;

http://www.abhisheksur.com/2010/05/design-patterns.html 24/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

public void Notify(string name)


{
if (this.NotifyChanged != null)
this.NotifyChanged(name);
}

#endregion

#region INotifyChanged Members

public event NotifyChangeEventHandler NotifyChanged;

#endregion
}

public class Observer : AbstractObserver


{
public override void ChangeState()
{
//Do something.
base.ChangeState();

}
}

You can definitely got the idea that after you Register for the Notification,
you will get it when ChangeState is called.

Iterator Pattern

This pattern provides a way to access elements from an aggregate


sequentially. Microsoft's IEnumerable is one of the example of this pattern.
Let me introduce this pattern using this interface.

http://www.abhisheksur.com/2010/05/design-patterns.html 25/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

IMPLEMENTATION

public class Element


{
public string Name { get; set; }
}

public class Iterator: IEnumerable<element>


{
public Element[] array;
public Element this[int i]
{
get
{
return array[i];
}
}

#region IEnumerable<element> Members

public IEnumerator<element> GetEnumerator()


{
foreach (Element arr in this.array)
yield return arr;
}

http://www.abhisheksur.com/2010/05/design-patterns.html 26/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

#endregion

#region IEnumerable Members

System.Collections.IEnumerator
System.Collections.IEnumerable.GetEnumerator()
{
foreach (Element arr in this.array)
yield return arr;
}

#endregion
}

Download Source code here

OR

DesignPatterns.zip (55.3 KB)

Conclusion

These are the basic design patterns. There are still few design patterns left
to be implemented. Stay tuned for those updates.
Thank you for reading.
Shout it Submit this story to DotNetKicks
Like 28 people like this. Sign Up to see what your friends like.

Read Disclaimer Notice

23 Comments Dot Net Tricks 


1 Login

 Recommend 3 t Tweet f Share Sort by Best

Join the discussion…

LOG IN WITH
OR SIGN UP WITH DISQUS ?

Name
http://www.abhisheksur.com/2010/05/design-patterns.html 27/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Aneel • 7 years ago


Very well structured and explained article...

Would be great if you can create a post which explores the real time
scenarios where each pattern might be used...

Also one other question: In the "Factory Method" pattern example, I


see that its gonna create an infinite loop, am I missing anything?
4△ ▽ • Reply • Share ›

Draqool > Aneel • 7 years ago


On the factory method..just return a new iphone..btw good job
Sur
1△ ▽ • Reply • Share ›

Shiva Kumar > Aneel • a month ago


client code vunte bagundu.

If client code would be it better.


△ ▽ • Reply • Share ›

abhi2434 Mod > Aneel • 7 years ago


Oh... I have to look into that. Thanks for letting me know.
△ ▽ • Reply • Share ›

Kunal Chowdhury • 9 years ago


Good one... :thumsup:

Regards,
Kunal
1△ ▽ • Reply • Share ›

aditya pathak • 10 months ago


Have you tested your code written in "Factory Method" example. It is
runs infinite. Please fix it.
△ ▽ • Reply • Share ›

DECS • a year ago


you covered main area and more briefly thank you
http://www.technotecode.in
△ ▽ • Reply • Share ›

Arman • 2 years ago


Thank you for your post. I think the singleton code can not lock an
http://www.abhisheksur.com/2010/05/design-patterns.html 28/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

object with null value. It throws an exception.


△ ▽ • Reply • Share ›

The Keshri Software Solutions • 3 years ago


The Keshri Software Solutions is a one-stop site for Asp(.)Net Live
Project Training. We have successfully completed several batches and
all are placed and working in a reputed company.Our aim is to provide
crystal clear concepts and to boost programming & technology skills
of candidates through best Live Project.

Please visit : http://training.ksoftware.c... for more details.


△ ▽ • Reply • Share ›

Maheswar Reddy • 4 years ago


This article is very nice.Easy to understand but here i noticed the
factory method example is wrong, it is circular implementation.
△ ▽ • Reply • Share ›

Naveen Ranaweera • 6 years ago


Please change the factory method example it will create infinite loop
so beginners will get misunderstood.Good article
△ ▽ • Reply • Share ›

Asad Naeem • 6 years ago


Great work...
△ ▽ • Reply • Share ›

MohankrishnaChowdary • 6 years ago


Really good one.. thanks..
Krishna
△ ▽ • Reply • Share ›

Fernando Urkijo • 7 years ago


Hi! Very nice article!
△ ▽ • Reply • Share ›

Knbinoj • 7 years ago


Very explanatory... Really userfull... Thanks a lot...
△ ▽ • Reply • Share ›

Aorte • 7 years ago


nice * n time very good thanks very much
△ ▽ • Reply • Share ›

abhi2434 Mod > Aorte • 7 years ago


Th k )
http://www.abhisheksur.com/2010/05/design-patterns.html 29/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#
Thanks... :)
△ ▽ • Reply • Share ›

avinash ranjan • 7 years ago


great but there should be a example like where to be use
△ ▽ • Reply • Share ›

Abhishek Sur • 8 years ago


Thanks pallab. :)
△ ▽ • Reply • Share ›

Pallab • 8 years ago


Well explained design pattern..
△ ▽ • Reply • Share ›

Abhishek Sur • 9 years ago


Thank you kunal.
△ ▽ • Reply • Share ›

Peter Juliano • 4 years ago


here's a better resource http://www.dofactory.com/
△ ▽ • Reply • Share ›

vikas singh > Peter Juliano • a year ago


If you're looking for regular updates on programming tech, you
could keep a watch on websites like
http://www.dotnetbasic.com
which will fetch you the latest updates from many
programmers.
△ ▽ • Reply • Share ›

ALSO ON DOT NET TRICKS

DOT NET TRICKS: .NET Book : DOT NET TRICKS: .NET Book :
Visual Studio 2013 Expert Visual Studio 2012 and .NET 4.5
Home
Newer Post Older Post

Author's new book

Abhishek authored one of the best selling book of .NET. It covers ASP.NET, WPF,
Windows 8, Threading, Memory Management, Internals, Visual Studio, HTML5,
JQuery and many more...
Grab it now !!!

http://www.abhisheksur.com/2010/05/design-patterns.html 30/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Blog Subscription

Enter your email.


Subscribe

Translate this page Spanish

Microsoft® Translator

Learn MVC 5 step by


step

My friend Shivprasad
Koirala who is also a
Microsoft ASP.NET
MVP has released
Learn MVC 5 step by
step video series. It
starts right from basics
of MVC and goes to a
level until you become a
professional. You can
start taking the course
for free using the below
youtube video.

Learn ASP.NE

Please try it, you will


find it awesome.

My Awards

http://www.abhisheksur.com/2010/05/design-patterns.html 31/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Client App Dev

Codeproject MVP

Codeproject Associate

Dotnetfunda MVP

Hit Counter

Twitter

Best .NET 4.5 Expert


CookBook

Abhishek authored one


of the best selling book
of .NET. It covers
ASP.NET, WPF,
Windows 8, Threading,
http://www.abhisheksur.com/2010/05/design-patterns.html 32/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Memory Management,
Internals, Visual
Studio, HTML5,
JQuery and many
more...

Grab it now !!!


Another book on .NET
4.5 has been released
very recently. It covers
Debugging, Testing,
Extensibility, WCF,
Windows Phone,
Windows Azure and
many more...

Grab it now !!!


GET ANY BOOK AT $5
from PacktPub. Offer is
limited

The Programmers
Newspaper

http://www.abhisheksur.com/2010/05/design-patterns.html 33/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

To Get your free copy,


Click here.

Join the TEAM

Followers (144) Next

Blogs I follow

Daily .NET Tips


Jon Skeet : Coding Blog
amazedsaint's tech
journal
Alvin Ashcraft's Morning
Dew
Abhijit's World of .NET

Blog Archive

► 2015 (2)
► 2014 (1)
► 2013 (5)
► 2012 (6)
► 2011 (58)
▼ 2010 (90)
► December (6)
► November (7)
► October (8)

http://www.abhisheksur.com/2010/05/design-patterns.html 34/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

► September (11)
► August (11)
► July (10)
► June (10)
▼ May (8)
WPF Tutorial :
Beginning to
Layout, Content,
Trans...
Strange
UserControl
Issue (Struck
with the
easiest...
Article Selected
@WindowsClien
t.net
Creating Splash
Screen (Without
Code)
Design Patterns in
C#
Object Notifiers
using
INotifyPropertyC
hanged, INo...
New WPF
Learning Series
How to escape {}
in XAML
► April (7)
► March (11)
► January (1)
► 2009 (5)
► 2008 (4)

Labels

.NET .NET 3.5


.NET 4.0 .NET 4.5
.NET infrastructure .NET
Memory Management

http://www.abhisheksur.com/2010/05/design-patterns.html 35/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

ADO.NET ALM
architecture ASP.NET
4.0 asp.net4.5 async Auto
property initialization await
Azure
beyondrelational
blogger tips book C# C#
6.0 C#5.0
CodeProject
Configuration cookbook
Custom Control Database
debugging design pattern
Developer Conference DLR
dotnetfunda.com
exception filters expression
bodies functions Extention
Finalize free GC Geolocator
gesture gift giveaways html5
IDisposable internals
IObservable. Rx
IsolatedStorage jquery
kinect LOH MEF Memory
Allocation Metro
multithreading MVP MVVM
nameof null condition Online
Session Patterns PDC10
Prism push technology
Reflection Regex scripting
silverlight SOH static class
string interpolation struct
Teched Testing TFS
Threading tips TPL TPL
Data Flows Unity Visual Studio
VS2012 WCF
WeakReference Windows
Phone Windows Phone7
Windows8
windowsclient.net
WinForms WinRT

WPF XAML

Popular Posts

Working with
CollectionView in
http://www.abhisheksur.com/2010/05/design-patterns.html 36/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

WPF(Filter,
Sort,
Group,
Navigate)
If you are working with
WPF for long, you might
already have come
across with
ICollectionView. It is the
primary Data object for
any WPF lis...

Design
Patterns in
C#
As I am
doing a lot of
architecture stuffs, lets
discuss the very basics
of designing a good
architecture. To begin
with this, you must
star...

Forum
Guys, Here is a forum
for you. Just drop any
Suggestion, Query,
Problem anything here. I
will try to solve it. Please
make sure that you pr...

All about
.NET
Timers - A
Compariso
n
Threads and Timers are
the most common things
that you need for your
application. Any work
that needs to be done in
background without
inter...

http://www.abhisheksur.com/2010/05/design-patterns.html 37/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

NotifyIcon with WPF


applications
NotifyIcon is an utility
form
System.Windows.Forms
which can be used by
any application to
invoke the default
notification from the
system t...

Introducing
Ribbon UI
Control for
WPF
Introduction After
reading Pete Brown in
his post on 2nd Aug
announcing the new
RibbonUI feature in his
post,
Announcing:Microsoft
Ribbon ...

Writing a
Reusable
Custom
Control in
WPF
In my previous post , I
have already defined
how you can inherit from
an existing control and
define your own
reusable chunk. The
reusable X...

Writing a
Custom
Configurati
onSection
to handle a Collection
Configuration is one of
the major thing that you
need to keep in mind

http://www.abhisheksur.com/2010/05/design-patterns.html 38/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

while building any


application. Either its an
Windows Forms
applicatio...

Win32 Handle (HWND)


& WPF Objects - A Note
Well, there is a common
confusion for many who
are working with WPF
objects, is does it truly
interoperable with
Windows environment,
or mor...

WPF
Tutorial
WPF, a.k.a
Windows
Presentation Foundation
provides an unified
model for producing
high end graphical
business application
easily using norm...

Pages

Home
About Me
My Skills
Achievements
People I Admire
My Publication
Frequently Asked
Questions

ABOUT ME JOIN ME TO GET UPDATED

ABHISHEK SUR

Follow 638

http://www.abhisheksur.com/2010/05/design-patterns.html 39/40
15/12/2018 DOT NET TRICKS: Design Patterns in C#

Microsoft
MVP, Client
Dot Net Tricks
412 likes
App Dev
Codeprojec
t MVP,
Associate | Dotnetfunda Like Page
MVP | Kolkata .NET Star
| Writer | Technology Be the first of your friends to like this
Evangelist | Technology
Lover | Geek | Speaker Follow me @abhi2434
VIEW MY COMPLETE PROF ILE

Copyright @DOT NET TRICKS all rights reserved. About Contact Disclaimer Notice Home Top

http://www.abhisheksur.com/2010/05/design-patterns.html 40/40

S-ar putea să vă placă și