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
B.OnSomethingHappend += new B.SomethingHappend(_B_OnSomethingHappend);
void _B_OnSomethingHappend(object sender, EventArgs eventArgs)
//do stuff when event in class A fired
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?