Writing event methods in MC++ with custom code

E

Edward Diener

I understand that specifying an __event, let's call it X, actually generates
add_X, remove_X, and raise_X methods in the class of the __event. If one
wants to allow the adding, subtracting, and calling of an event from outside
the class, and one is implementing these methods for oneself with custom
code rather than letting the compiler do it using the "__event ADelegate *
X;" methodology, do the methods with the __event keyword specified above
have to be accessible by the user of the __event ? In other words, does the
compiler translate event addition via X += ADelegate, event deletion via
X -= ADelegate, and event raising via X(someparm) as actual calls to the
member functions mentioned above in the code, or is there an indirect call
into something public within the class which actually calls the appropriate
__event member function.
 
D

Daniel O'Connell

Edward Diener said:
I understand that specifying an __event, let's call it X, actually generates
add_X, remove_X, and raise_X methods in the class of the __event. If one
wants to allow the adding, subtracting, and calling of an event from outside
the class, and one is implementing these methods for oneself with custom
code rather than letting the compiler do it using the "__event ADelegate *
X;" methodology, do the methods with the __event keyword specified above
have to be accessible by the user of the __event ? In other words, does the
compiler translate event addition via X += ADelegate, event deletion via
X -= ADelegate, and event raising via X(someparm) as actual calls to the
member functions mentioned above in the code, or is there an indirect call
into something public within the class which actually calls the appropriate
__event member function.

It should be translated into an add_X method. You can write sample code and
load ildasm to examine the results, IL is a pretty easy language to read and
it should give you an answer faster than these groups will.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top