G
Guest
There are a set of clients who need to be notified of certain events. I have
used events and delegates (publisher-Subscriber model) for the
notification mechanism. All the clients register with the event publisher
and subscribe for the events that they are interested in. When a certain
event happens, the subscribers are notified about it.
I want the clients to return a value after their callback method is called.
If any of the client returns true, I do not want to invoke the other
subscribers. The order in which the clients are notified is immaterial.
Problem:
How can the clients return a value? According to the MSDN documentation, the
return value is void in the delegate signature. I can change it to int, but
FxCop complains about it.
In Applied Microsoft .Net Framework, Jeffrey Richter talks about using
inheritance to solve this problem - "The derived type might decide not
to have the event forwarded on." Can someone please shed some light on how
to solve the problem?
used events and delegates (publisher-Subscriber model) for the
notification mechanism. All the clients register with the event publisher
and subscribe for the events that they are interested in. When a certain
event happens, the subscribers are notified about it.
I want the clients to return a value after their callback method is called.
If any of the client returns true, I do not want to invoke the other
subscribers. The order in which the clients are notified is immaterial.
Problem:
How can the clients return a value? According to the MSDN documentation, the
return value is void in the delegate signature. I can change it to int, but
FxCop complains about it.
In Applied Microsoft .Net Framework, Jeffrey Richter talks about using
inheritance to solve this problem - "The derived type might decide not
to have the event forwarded on." Can someone please shed some light on how
to solve the problem?