testing event == nullptr


With the old syntax you had to test whether there was any handler connected to an event by writing
  if (myevent != nullptr) myevent(this, myargs);

With the new syntax you no longer have to perform the test, which is good, but what if I really want to know if there are handlers What would be the syntax then

Chris.


Answer this question

testing event == nullptr

  • Chien-hao Wen

    Hi Chris: the feeling of the C++/CLI design team was that an event is an abstraction of add, remove and raise and that users shouldn't really be peeking behind the curtain Smile. If you really want this level of control then I would suggest that you use a raw delegate instead of an event.

  • testing event == nullptr