Proper way of raising events from C++/CLI?
问题 I was wondering what's the proper way of raising events from C++/CLI. In C# one should first make a copy of the handler, check if it's not null, and then call it. Is there a similar practice for C++/CLI? 回答1: C++/CLI allows you to override raise in custom event handlers so you don't have to test for null or copy when raising the event. Of course, inside your custom raise you still have to do this. Example, adapted from the MSDN for correctness: public delegate void f(int); public ref struct E