hi all!
<i'm fairly new to csharp (and dotnet) and is particularly
confused with delegates and events.. so forgive me if im a bit dense..>
Is there any major concern that i need to think about when
triggerring an event or a delegate using DynamicInvoke()
versus simply calling the event..
MyEvent.Dynamic Invoke(sender, args);
//versus this:
MyEvent(sender, args);
I worry about this, since im trying to create an "EventPool"
collection. The events/delegates are dynamically created
(published) in a hash table. And other classes trigger
these events through the EventPool class.
Triggering an event calls either one of the statements above.
...and do you have any suggestions regarding the
creation of an EventPool. Im still not sure how to publish
unique events. Right now, i have two options:
1. using a string name that is specified by string
literals in both the publisher and the subscriber
(two different classes from possibly two different assemblies).
2. create a sort of utility class (sealed and non-instantiatable) ..
with static declarations for the delegates.. then i use
the ToString() function of those delegates to determine
a event name (the publisher & subscribers need a reference
to this class).
i wanted to sort of de-couple the publisher & subscriber <sort of>
this would be easier in C++ since we can have header files
with #defines in it.. that both the publisher & the subsriber
would only need to include.
am i even going in the right direction?
pls help.
thank you.
--
It is only through the heart that one can see rightly. (The Little Prince)
MickeyMicks