I am updating some old managed C ++ code with lines like this:
instanceOfEventSource- & gt; Add_OnMyEvent (new event source: MyEventHandlerDelegate (this, MyEventHandlerMethod));
Where
- EventsSource is the category that publishes events
- instanceOfEventSource
- EventSource :: MyEventHandlerDelegate is the representative type for the event
- MyEventHandlerMethod is a non-static) within the existing class The method (in which "this is an example"), which matches the signature EventSource :: MyEventHandlerDelegate
What is the correct syntax in C ++ / CLI for this?
Syntax is similar to C #, in other words, + =
is To make this possible overloaded:
example ofEventSource.MyEvent + = gcnew EventSource :: MyEventHandlerDelegate (this, and MyClass :: MyEventHandlerMethod);
Unlike C #, to remove conformity, however, you can not leave the obvious acceleration of the event handler representative, so it generates a long curved code.
Comments
Post a Comment