troubleshooting Question

event binding/chaining

Avatar of DaFou
DaFou asked on
5 Comments1 Solution245 ViewsLast Modified:
Hi All,

I have 3 classes. class A, B and C. with all 3 classes having the event OnSomethingHappend.
A.OnSomethingHappend, B.OnSomethingHappend and C.OnSomethingHappend

C had a member of type B
B has a member of type A


How can i chain the event OnSomethingHappend from A all the way to C via B
So that if the event fires in a it is automaticly bubled up to C and fires there aswell.

I want to bind the events somehow rather then passing on the event.
S0 what i dont want to do is create an event handler in class C that responds to the event in class B that is fired when the event in class A happens.

So code i dont want to use is like this for
class C
B.OnSomethingHappend += new B.SomethingHappend(_B_OnSomethingHappend);

void _B_OnSomethingHappend(object sender, EventArgs eventArgs)
            //do stuff when event in class A fired

Class B
A.OnSomethingHappend += new A.SomethingHappend(_A_OnSomethingHappend);

void _A_OnSomethingHappend(object sender, EventArgs eventArgs)
            OnSomethingHappend(this, new EventArgs());

Is there a more cleaner way to bind/chain events?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 5 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 5 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004