Hi rawCoder,
I think you are looking for something like bubbling the events on the
collection level. If you are, then I must say that the events don't bubble
by them selfs.
So, as far as I can see you have couples of ways to solve this.
1. To handle the events before adding the objects to the collection. This
can be done also via creating custom collection that will accept a delegate
in the Add method or using some other technique.
2. To declare this event as static. Here you don't have to have a reference
to the object to handle the event. The drawback of this of course is that
the event handler doesn't know the context of the object raised the
exception. It could be in a the collection, in a separate thread actually
anywhere in the same appdomain.
3. To have custom collection that hooks to the event upon accepting objects
and unhooks the event when the object is removed. Then the collection will
raise some more generic event giving the information about the actual even
and the object that raised it. In other words implementation to some extend
of the event bubbling.
HTH
Stoitcho Goutsev (100) [C# MVP]
"rawCoder" <ra******@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi,
I must be missing something here.
All I want is to be able to handle the events of one of my class, objects
of
which are in a collection.
For e.g. I have a class MyClass1 which raises MyEvent1 and a collection
which holds its objects. I want to be able to handle the events when any
object of MyClass1 raises a MyEvent1.
rawCoder