Re: c# events - 2 independent classes listening to each other?
- From: gavin@xxxxxxxxxxx
- Date: 9 Sep 2005 08:24:43 -0700
Oliver Sturm wrote:
> john_teague wrote:
>
> >What you are referring to is the Observer pattern. Microsoft has a
> >article that explains the pattern and how to do this with events and
> >delegates.
> >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/observerpattern.asp
> >
> >You are essentially correct, in that the they must be wired up in the
> >aspx page. This article takes it a step further and puts a method in
> >the "Observer object" that acts as the delegate that "listens" for the
> >event in your second object.
>
> I'm sorry, but I don't think this is the right answer. Of course, an
> object listening to events from another object is an example of the
> observer pattern, but the specific problem here is that the objects don't
> have any reference to each other.
>
> I believe a much better pattern to suggest as a solution to the specific
> problem is the Mediator pattern. There's a good description with a quick
> introduction at the following URL:
> http://my.execpc.com/~gopalan/design/behavioral/mediator/mediator.html
>
>
>
> Oliver Sturm
> --
> Expert programming and consulting services available
> See http://www.sturmnet.org (try /blog as well)
Hi again, I just read about the mediator pattern and it does seem to
work well for my needs, I rattled yup a quick prototype and am quite
happy with how it hangs together.
I do appreciates everyones help on this, thanks!
.
- Follow-Ups:
- Re: c# events - 2 independent classes listening to each other?
- From: john_teague
- Re: c# events - 2 independent classes listening to each other?
- References:
- c# events - 2 independent classes listening to each other?
- From: gavin
- Re: c# events - 2 independent classes listening to each other?
- From: john_teague
- Re: c# events - 2 independent classes listening to each other?
- From: Oliver Sturm
- c# events - 2 independent classes listening to each other?
- Prev by Date: Re: Datagrid: Merge Cells
- Next by Date: HOw to add items to CDO Fields collection?
- Previous by thread: Re: c# events - 2 independent classes listening to each other?
- Next by thread: Re: c# events - 2 independent classes listening to each other?
- Index(es):
Relevant Pages
|