Attributes and events

  • Thread starter Thread starter Edward Diener
  • Start date Start date
E

Edward Diener

One can specify an event as either the raw event:

__event System::EventHandler * OnSomethingChanged;

or as a series of add_,remove_, and raise_ methods:

__event virtual void remove_OnSomethingChanged(System::EventHandler *);
__event virtual void add_OnSomethingChanged(System::EventHandler *);
__event virtual void raise_OnSomethingChanged(System::Object,
*System::EventHandler *);

In the latter case, when creating an attribute for the event, ie.
[System::ComponentModel::DescriptionAttribute("Something Changed")] , is it
sufficient to specify it before any one of the __event member functions, or must
one repeat the attribute for all ?
 
In the case of properties, applying to any of the get_ or set_ works, so I
guess the same should hold true for events as well.

- Atul
Sky Software http://www.ssware.com/
Shell MegaPack ActiveX & .Net
Drop-In Windows Explorer-Like Shell Browsing UI for your apps.
 
Atul said:
In the case of properties, applying to any of the get_ or set_ works

Yes, I know.
, so I
guess the same should hold true for events as well.

I hope so but I was hoping someone knew for sure. Maybe no one has ever used an
attribute with the extended form of specifying events. I will assume I only need
the attribute on one of the three event methods.
- Atul
Sky Software http://www.ssware.com/
Shell MegaPack ActiveX & .Net
Drop-In Windows Explorer-Like Shell Browsing UI for your apps.


One can specify an event as either the raw event:

__event System::EventHandler * OnSomethingChanged;

or as a series of add_,remove_, and raise_ methods:

__event virtual void remove_OnSomethingChanged(System::EventHandler *);
__event virtual void add_OnSomethingChanged(System::EventHandler *);
__event virtual void raise_OnSomethingChanged(System::Object,
*System::EventHandler *);

In the latter case, when creating an attribute for the event, ie.
[System::ComponentModel::DescriptionAttribute("Something Changed")] , is
it sufficient to specify it before any one of the __event member
functions, or must one repeat the attribute for all ?
 
Back
Top