Dofactory.com
Dofactory.com
 Back to list
Views:   19.2K
Replies:  2
Archived

Delegate (C#) versus Observer Pattern?

I have a question: Is the delegate in C# equivalent to the Observer Pattern?  If not, what is the difference?

Thanks in advance.
Asmprogs Asmprogs, Sep 03, 2010
Reply 1
In C# Langaugage, Microsoft has provided the facility of multi-cast delegate to implement the Observer Pattern.  As Rajesh has mentioned there are sites which provides the implementation of same.

At the same time there is something you need to be aware off when using the multi-cast delegate. If the user has assigned, say two delegates and then assigns a null value, it will be treated as un-assigned and both previously assigned delegates will not execute.

- Saurabh
Saurabh Saxena, Sep 06, 2010
Reply 2
Rajesh Pillai, Sep 03, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.